Windows limit the number of windows handles to 10.000. That's why ICS V7 is designed to use only one handler for a lot of TWSocket so that you can create a lot of sockets. Which OS are you using which allows creating 1.000.000 handles ?

Classes.AllocateHwnd and TIcsWndHandler.AllocateHWnd both use the same API (CreateWindowEx ) to create the handle so both should be able to create the same number of those.

The number of TWSocket which can be created also depends on the "non page memory pool" you OS has. Each socket consume some space there and this space is not unlimited.

--
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: "Eric Fleming Bonilha" <e...@digifort.com.br>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Thursday, August 12, 2010 6:56 PM
Subject: [twsocket] ICS Message handlers


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 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