Discussion:
ICS: Thread or not
(too old to reply)
Nick Rollas
2005-05-25 23:38:50 UTC
Permalink
Hello,

I just need to developer a control software that will accept specific number
of connection, ie 300 from 300 predefined IPs. The connection will be opened
all the time, because the server software must know if the remote computer
restarted. Also the server software may send commands to the remote
machines. The command may be a single 20 characters string or maybe the
content of a trieview list (as a stream).

Im trying ICS, I can see 2 examples TcpSrv and ThrdSrv. What is better for
me? The threaded or the non-threaded?

Thank you
Francois Piette [ICS & Midware]
2005-05-26 07:10:40 UTC
Permalink
Post by Nick Rollas
I just need to developer a control software that will accept specific number
of connection, ie 300 from 300 predefined IPs. The connection will be opened
all the time, because the server software must know if the remote computer
restarted. Also the server software may send commands to the remote
machines. The command may be a single 20 characters string or maybe the
content of a trieview list (as a stream).
Im trying ICS, I can see 2 examples TcpSrv and ThrdSrv.
There are other samples too...
Post by Nick Rollas
What is better for me? The threaded or the non-threaded?
It depends on what processing you have to do. 300 connections for a single
thread is not a problem if most are dormant. ICS is non blocking and event
driven so doesn't require multithreading. If you have lot of processing,
specially blocking processing such as lengthy SQL requests, then you should
use multithreading for doing your processing. If you have a multi-processor
computer, then you may use multithreading to make use of all processors (one
thread per processor is enough). You coud for example have a thread that
runs the TWSocketServer and one thread per processor. When a new connection
comes in (event of TWSocketServer), you attach the connection to the least
used thread (TWSocket has ThreadAttach and ThreadDetach methods).

I have applications with more than 500 users and still using a single thread
for communications, but a thread for each lengthy database request.

btw: If you want help about ICS? you'd better use the support mailing list
where about one thousand ICS users share their knowledges. To subscribe
please goto http://www.elists.org/mailman/listinfo/twsocket or visit
"support" page at ICS website http://www.overbyte.be

--
Contribute to the SSL Effort. Visit
http://www.overbyte.be/eng/ssl.html
--
***@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

Loading...