J
Jeremy
I'm using NetworkStream to read from a TCPClient.
I'm testing DataAvailable before reading to keep by thread from
blocking on read.
The docs say that if the remote end has closed the connection, a call
to DataAvailable should throw a SocketException. Unfortunatly, the
exception isn't getting thrown, so my code keeps spinning on
DataAvailable forever, never knowing that the connection has been
closed. There don't seem to be any other properties or methods in
either TCPClient or NetworkStream that I can use to get the connection
state without potentially blocking.
Am I missing something? Is there another way to determine if the
connection is active without risking a block?
Thanks.
* the reply-to mailbox is not checked
* send replies to: jj AT imtc DOT gatech DOT edu.
I'm testing DataAvailable before reading to keep by thread from
blocking on read.
The docs say that if the remote end has closed the connection, a call
to DataAvailable should throw a SocketException. Unfortunatly, the
exception isn't getting thrown, so my code keeps spinning on
DataAvailable forever, never knowing that the connection has been
closed. There don't seem to be any other properties or methods in
either TCPClient or NetworkStream that I can use to get the connection
state without potentially blocking.
Am I missing something? Is there another way to determine if the
connection is active without risking a block?
Thanks.
* the reply-to mailbox is not checked
* send replies to: jj AT imtc DOT gatech DOT edu.