title: How can I simulate a 'plugged network cable' (TCP/IP)?
body: <p>I would like to test some network error conditions, but I have no network cable. Both TCP client and server application running on the same system. </p>
  
  <p>Would it be a realistic simulation to use a tool like TCPView to close a connection, instead of unplugging the network cable?</p>
  
  <hr>
  
  <p>Update: </p>
  
  <ul>
  <li>disconnecting using TCPView results in a 10054 error which can be handled in the application code. 10054 is a WSAECONNRESET - The connection was reset by peer. This is usually more an issue on the other side of the connection.</li>
  </ul>
  
  <p>I have also learned from <a href="https://stackoverflow.com/a/8500760/80901">this answer</a> that "You can unplug a network and then plug it back in, or your Wi-Fi laptop can lose reception for a second and then pick it back up. It would be frustrating if such resumable cases were treated as an error in all the programs we use." (See: <a href="https://stackoverflow.com/questions/8500664/how-server-socket-know-network-cable-in-unplugged-in-windows-using-c">how server socket know network cable in unplugged in windows using c++</a>)</p>