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.


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

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

hello,
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 89.24.4.161: 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


--
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
eml: lukas.sk...@envinet.cz, luky.sk...@gmail.com
www: http://envinet.cz




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