Sometimes Windows triggers OnDataAvailable when no data is actually available. This is how it works. It is safe to ignore it. The most important is to call Recv (or any derivative) anyway. Using RcvdCount to decide to call or no Recv is wrong. Always call Recv which is the only one to actually reset winsock internal flag.
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)

-----Message d'origine----- From: Lukas Skala
Sent: Wednesday, August 17, 2011 4:01 PM
Subject: [twsocket] multithread server

I have tcp server (developed as Windows Service) based on
OverbyteIcsThrdSrv1.pas demo. There is maximum of 200 clients. Server is
hanging after some time of running - it is unable to connect any new client.

I have added log in all events of TWSocketServer (оn events start line
and events end line). So I know that program is not hanging in any
events. I have some timer in service also and operation inside OnTimer
events are also logged. When server is hanged timer event is no more
triggered - it seems that main thread is very busy by triggering
OnClientDataAvailable - but in fact no data are incoming, function
RcvdCount in OnClientDataAvailable events returns zero and function
Receive returns -1 length (see part of log below please). Please what
does it means (why is this event triggered when no data are incoming?)
and how to avoid this behaviour?

17.08.11 15:42:52 I ClientDataAvailable started.
17.08.11 15:42:52 I Received from 0 byte(s).
17.08.11 15:42:52 D Received -1 byte(s).
17.08.11 15:42:52 I ClientDataAvailable ended.

Thanks for any idea.

lukas skala
envinet a.s.
divize projektu a inzenyringu (project and engineering division)
modrinova 1094
674 01 trebic

tel: +420 568 409 862 (811)
fax: +420 568 409 875
gsm: +420 724 461 062
icq: 66842878

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