Hi
I'm using a TCPClient to connect to a remote server, and I get messages from
this server using the associated NetworkStream.
As soon as I'm connected to the server, I use this code to read data :
while (stream.DataAvailable)
{
// there is data, read them
int numberOfBytesRead = stream.Read(m_readBuffer, m_currentIndex,
m_readBuffer.Length - m_currentIndex);
.....
}
If I look the documentation for 'DataAvailable', it says : " If the remote
host shuts down or closes the connection, DataAvailable throws a
SocketException "
My problem is that I never get this exception thrown. I close the remote
server, and my client keeps telling me there are no data available... and
doe snot throw...
Do you know what's wrong ?
thanks