title: Best socket options for client and sever that continuously transfer data
body: <p>I am using Java (although I think the socket options is implement in most languages) to implement a client and server. The server sends data to the client for processing which the client acknowledges. On another port the client then sends the results of the processing back to the server. When it comes to options such as</p>
  
  <ul>
  <li>SO_LINGER</li>
  <li>SO_KEEPALIVE</li>
  <li>SO_NODELAY</li>
  <li>SO_REUSEADDRESS</li>
  <li>SO_SENDBUFFER</li>
  <li>SO_RECBUFFER</li>
  <li>TCP_NODELAY</li>
  </ul>
  
  <p>We have noticed that the connection between the client and server occasionally breaks. There will be a timeout on the send or the receive. When this happens will kill the socket and open a new one to continue.</p>
  
  <p>What would be the best options to set in terms of the above scenario and is there anything that we could do from our side (programmatically or options-wise) to try minimize the amount of times the connection is dropped. We are using normal TCP/IP.</p>
  
  <p>UPDATE:
  The bounty on this ends soon. I haven't had a satisfactory answer yet so it is still open. I think everyone is missing the point of the quest. What is the best practice with regards to the options above for sockets that continuously chat. I have already got a ping packet in that if there is no work to be done (hardly ever the scenario) the normal message is sent with no inner elements so there is always processing.</p>