> Actually I thing that this exception was raised because of the
> architecture of my software and I need an opinion about that.
What is exacly the exception message ?
> when I have some hosts down. My app has a Timeout parameter (Default 4
> seconds) when if it doesn´t receives video from the host it closes the
> connection and opens it again
You have to call Close (or CloseDelayed), and in OnSessionClosed you
post a message to custom message handler where you connect again.
> I have tried to do this reconnect to the host by 2 ways, by Closing
> and Opening the TWSocket connection again and by Destroying and
> Creating a new TWSocket component each time it needs to reconnect to
> the host (at each 4 seconds)
Both are good. Closing / opening will be the most preferabel in my
> on the first way (Closing and Opening) I
> got some EOutOfMemory error on ICS
Is it 'no buffer space available' ? Because Windows keep the socket for
a while after closing the connection (I think 2 minute). Sockets are
made into the non paged memory pool which stop growing at 1/8 the size
of physical RAM. So with the amount of sockets in TIME_WAIT state + the
sockets you create it could be that you run out of memory ? Consider
that a socket takes around 2 KB, and that overlapped IO (used by
winsock) eat also in blocks of 4 KB.
> and on this second way (Destroying
> and Creating the TWSocket component) I got that exception message at
> the beggining of the email.
I cannot see the exact exception message. Can you give it ?
> Can you tell me if this reconnection procedure that I made (each 4
> seconds for down hosts) is dangerous to TCP at any way?
Definitively not. But possible you have a memory problem because of the
TIME_WAIT sockets (nothing to do with ICS, but that's how winsock
> Another thing that I have thinked is that if I need to wait the
> TWSocket connection error message before trying to reconnect to the
> host or I can close if before receiving the error message?
Use OnSessionClosed. But do not reconnect from within the event handler,
but post a custom message so that the reconnect is outside the event.
Rgds, Wilfried [TeamICS]
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be