sunburnt
Mar 11th, 2003, 07:09 PM
I posted this a while ago, but I can't seem to get an answer or find one elsewhere. Anyway, how does one know when a NetworkStream or TcpClient's connection is closed? Right now I'm doing something like this:
try
{
while(_nstream != null)
{
//read / write
}
}
catch
{
// socket closed?
}
but this never seems to work. the connection will be terminated by the remote host, but you wouldn't know it... any suggestions?
try
{
while(_nstream != null)
{
//read / write
}
}
catch
{
// socket closed?
}
but this never seems to work. the connection will be terminated by the remote host, but you wouldn't know it... any suggestions?