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:
but this never seems to work. the connection will be terminated by the remote host, but you wouldn't know it... any suggestions?Code:try { while(_nstream != null) { //read / write } } catch { // socket closed? }





Reply With Quote