Re: [twsocket] Proper DataAvailable handling

2010-01-28 Thread Anton Sviridov
Thank you, Francois, wonderful answer, things are getting completely clear! -- Anton -- 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

Re: [twsocket] Proper DataAvailable handling

2010-01-28 Thread Francois PIETTE
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 sa

Re: [twsocket] Proper DataAvailable handling

2010-01-28 Thread Anton Sviridov
Forgot to mention: the 2nd and 3rd snippets are for different purposes and are members of different classes. -- Anton -- 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

[twsocket] Proper DataAvailable handling

2010-01-28 Thread Anton Sviridov
What is the proper way to handle TWSocket.DataAvailable? I found this way in demo: function TBinaryWSocket.TriggerDataAvailable(ErrCode: Word): Boolean; var Rcvd: Integer; begin Result := TRUE; Rcvd := Receive(@FRcvBuf[FWriteOffs], (SizeOf(FRcvBuf) - FWriteOffs)); if Rcvd > 0 then