I found that Receive returns -1 with WSAEWOULDBLOCK error when
DoDataAvailable is called with RcvdCount = 0.
WSAEWOULDBLOCK should safely be ignored.
So, the first question is: is it necessary to call method when no data
available in fact,
Yes, it. There is somewhere a note from Microsoft saying RcvdCount is not
and the second: how to implement DataAvailable code in proper way? Is it
async Receive to returb some error besides WSAEWOULDBLOCK (i.e. do I need
to check the error and report about it)?
Receive never return another error than WSAEWOULDBLOCK.
It returns 0 when the remote has gracefully closed the connection.
It return -1 and WSAEWOULDBLOCK when no data is available even if Windows
triggered the FD_READ event which in turn triggers OnDataAvailable event.
Any positive value means you got data in your buffer. If the returned value
is smaller than your buffer then you have received all data. If not, the
more data is available immediately. It is always better to always read all
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
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