Instead of ReceiveStr, call Receive to be able to get winsock.recv return 
code. This return code is -1 if some error occure, 0 is remote has 
gracefully closed or a positive integer to telle how many bytes you have 
received.

Usually you can safely ignore any OnDataAvailable where Receive return <= 0.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be



----- Original Message ----- 
From: "Jack" <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Sunday, January 22, 2006 5:25 AM
Subject: [twsocket] OnDataAvailable called before shutdown with no data


> Hello Francois and all,
>
> I use telnet as client to connect to a twsocketserver,
> after connecting to it, without sending any data from
> the client (do not type anything in telnet) I call shutdown(1)
> on all the client sockets. After this, although there is no
> data received, the client socket's OnDataAvailable is called.
> But if I call ReceiveStr(), I got data length 0.
>
> Is this a bug - because there's actually no data received?
>
> If it's not a bug, is there a way to tell if there is any
> data before calling ReceiveStr() or Receive()?
>
> -- 
> Best regards,
> Jack
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to