>From the sound of it the socket pool approach certainly looks like the way to 
>go. I am dealing with a bit less than 300 potential servers 
for this process. I tried a version of the "wait until it's closed" approach, 
but all that ever did was lock up the application, no doubt because I wrote it 
incorrectly in the first place. :)

I have no idea, however, how to go about creating or using a pool such as you 
describe. I've really only ever dealt with a single client/server pair on 
anything other than the Indy components. Would you be so kind as to point me 
toward some resource, example, or tutorial on this subject?

---- Angus Robertson - Magenta Systems Ltd <an...@magsys.co.uk> wrote: 
> > This new version has presented me with a problem. I can 
> > successfully connect to the first device in the list, and send 
> > the command in the OnConnected event. Through reading comments in 
> > the source, I understand that the problems originated with the 
> > way I'm handling this. 
> > 
> > After the first connect, I try to do the next, which, I can see, 
> > is the problem. I cannot change the address because that original 
> > connection is still open. 
> 
> You are using async functions, and trying to start a second connection
> on the socket before the first has closed. 
> 
> You either need to check in your loop that the socket state is closed
> already and wait until it is, or create an array of TWSockets so you
> can send these several messages in parallel.  
> 
> The big problem with TCP/IP is connection timeouts, it will usually
> wait 30 to 60 seconds attempting to make a connection before giving an
> error, which can slow down your messaging dramatically with a single
> socket.  
> 
> So multiple sockets is the way to go.  You don't say how many devices
> you are dealing with, if it's dozens then one wsocket each is trivial,
> if it's hundreds or thousands you probably want to create a socket pool
> of maybe 100 wsockets and use them as they come free.  
> 
> Windows can only open so many new sockets per second, particularly if
> you are using SSL, thus the pool.
> 
> All the sockets can share the same event handlers, when you create them
> set the Tag property to the counter number and check Tag in the event
> so you know what data to send.   
> 
> 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

Reply via email to