PDA

Click to See Complete Forum and Search --> : Socket closed


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?

PT Exorcist
Mar 12th, 2003, 07:53 AM
look over pscode.com they have plenty of examples about that