It will be interesting to hear an answer to this...

Thank you,


On Thu, Aug 12, 2010 at 7:56 PM, Eric Fleming Bonilha

> Dear ICS Team,
> I found a problem in our software that is limiting the total ammount of TCP
> sockets that I can create.
> The problem that I found is that I can´t create many many instances of
> TWSocket, because of its internal message handler (I did many tests), here
> are my findinds:
> We use AllocateHWnd from Classes.pas to allocate message handlers to
> several different objects in our software, so, at one time we can have over
> 1000 handles allocated across the software
> I did some tests and using a service application I could create about
> 170.000 instaces of TWSocket, but if I allocate some thousand handles (By
> using Classes.AllocateHWnd) than I can´t create ANY instance of TWSocket, in
> my tests I created 10.000 handles by using classes.allocatehwnd, than I
> couldn´t create any TWSocket
> Since my app can have many handles and I need many sockets, I did many
> tests and found that procedure TIcsWndHandler.AllocateHWnd; create its own
> windows handle, instead of using classes.allocatehwnd
> How does this scheme works?
> To make a test, I changed the ICS implementaion of procedure
> TIcsWndHandler.AllocateHWnd; to create the handle using
> Classes.AllocateHWnd, then, I could create over 800.000 instances of
> TWSocket, and at least in my tests, it was connecting to hosts and receiving
> data correctly
> And the better, if I create 1.000.000 of handlers by using
> CLasses.AllocateHWnd, I could create over 700.000 instaces of TWSocket
> yet...
> So, If I change my ICS code to allocate the message handler by using
> Classes.AllocateHWnd instead of using the implementation of procedure
> TIcsWndHandler.AllocateHWnd;
> What could go wrong?
> Because at preliminary tests, the sockets were working OK, even in
> multi-threading and I almost have no limit of socket creation
> Eric
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto
> Visit our website at
To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to