Looks like you started to grasp async programming. Very good !
Don't forget you have to free the TWSocket at some time.
I think you still need a single TTimer to handle timeout. Think about what
will happend if you start a connection successfully and then have a server
not answering at all, but letting the connection opened. I guess you want to
break the connection to that server after some timeout.
--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
----- Original Message -----
From: "Chris Schofield" <ch...@c-j-s.co.uk>
To: "'ICS support mailing'" <twsocket@elists.org>
Sent: Tuesday, December 08, 2009 1:35 PM
Subject: Re: [twsocket] Use of twsocket in thttpserver application
Hi Angus (and all who have helped)
I have created an array of (50) Twsockets. I then choose a new one each
time I need to connect as you suggested.
It works perfectly. I don't need the timer anymore and have removed the
application.processmessages.
Everything seems perfect. I need to give it a good testing now.
Many thanks
Chris
-----Original Message-----
From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On
Behalf Of Angus Robertson - Magenta Systems Ltd
Sent: 08 December 2009 09:31
To: twsocket@elists.org
Subject: Re: [twsocket] Use of twsocket in thttpserver application
I am using application.processmessages because I need to connect to
several different sockets as follows
Just create a dynamic array with one TWSocket for each connection, then
start them all together.
Application.ProcessMessages can be used in ICS client applications using
the sync methods, but must never be used in ICS server applications which
are purely async.
The connected event closes the connection. My timer aborts the
connection if it takes too long.
You only need a single timer that checks if the connections have
completed, again an array of tickcounts when they started. Not really
necessary to abort them, since a connection should always time out
eventually. The ICS FTP server code does this to close idle clients.
Angus
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be