title: Do TCP sockets automatically close after some time if no data is sent?
body: <p>I have a client server situation where the client opens a TCP socket to the server, and sometimes long periods of time will pass with no data being sent between them. I have encountered an issue where the server tries to send data to the client, and it seems to be successful, but the client never receives it, and after a few minutes, it looks like the client then gets disconnected.</p>
  
  <p>Do I need to send some kind of keep alive packet every once in a while?</p>
  
  <p><strong>Edit</strong>: To note, this is with peers on the same computer. The computer is behind a NAT, that forwards a range of ports used to this computer. The client that connects with the server opens the connection via DNS. i.e. it uses the mydomain.net &amp; port to connect.</p>