Wilfried Mestdagh wrote:
> Hello Anton,
> 
> Don't worry. You don't have to do anything on the 'would block'
> winsock error. TWSocket deals with it.
> 
> when OnDataAvailable fires, just try to receive all data. When Receive
> return 0 or -1 then just exit the event handler.
> 
> -1 is error (don't worry), and 0 is if the peer has closed.

As I understand the OP calls receive multiple times in OnDataAvailable
which is not a good idea.

--
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> ---
> Rgds, Wilfried [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
> http://www.mestdagh.biz
> 
> Tuesday, November 25, 2008, 15:29, Anton Sviridov wrote:
> 
>> I'm now implementing a server on the base of TWSocketServer. In the
>> client app I send some message to the server app, which receives it
>> inside ServerIn_ClientDataAvailable procedure. Receiving is realized
>> step by step to find a signature of message - i.e., there are several
>> client.Receive in the method.
>> I faced with strange thing: after whole message is read (and no
>> data is sent yet), client's OnDataAvailable is executed some more
>> times. TMsgReceiveSocket(Sender).RcvdCount returns 0, and Receive
>> returns -1 with error code "Would block". So the question: why
>> OnDataAvailable is executed when there is actually no data to be
>> read? 
> 
>> --
>> Best regards, 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

Reply via email to