title: C# TCPClient/Socket writing not throwing exception
body: <p>I have many printers I am trying to connect to over tcp connections. I am trying to verify that my TcpClient is still connected to update a GUI. I am trying to write to a socket to make sure its still connected. I get no exception even if the cable is unplugged I tried all of the suggestions here <a href="http://social.msdn.microsoft.com/Forums/en-US/19d0b31b-9608-4e1e-9608-d8cdd8676287/detect-connection-status-in-tcp-or-socket-at-c?forum=netfxnetcom" rel="nofollow">MSDN_Fourm</a></p>
  
  <p>I am receiving the expected exception after I try to check the printer statuses</p>
  
  <p>psudo-code
  client is a TCPClient that has been connected previously</p>
  
  <pre><code>private bool FuntionPsudo(){
      try{
          if(client.Connected){
              byte[] buf = new byte[1];
              client.Client.Send(buf, 0,0);
              client.GetStream().Write(buf,0,0);
              if(client.Client.Receive(buf,SocketFlags.Peek)==0)
                  return false;
              return true;
          }
      }
      catch(Exception){
          return false;
      }
  
      return false;
  }
  </code></pre>
  
  <p>FuntionPsudo returns: true</p>
  
  <p>cable unplugged</p>
  
  <p>FuntionPsudo returns: true</p>
  
  <p>FuntionPsudo returns: true</p>
  
  <p>check printer status</p>
  
  <p>FuntionPsudo returns: false</p>
  
  <p>Thanks in advance for any help on why this might be happening and/or how to fix it</p>