title: How to turn TCP Keepalive off?
body: <p>I have a java application acting a a server and an android phone acting as a client. They are communicating over TCP sockets. </p>
  
  <p>I often have the client sleep and when its buffer fills I want the wifi radio to be able to go to sleep. The problem is the client isn't sleeping. I noticed wireshark says my server is sending the a TCP KeepAlive packet approximately every half second so the wifi can't sleep. I've tried the following on the server and client.</p>
  
  <pre><code>connectionSocket.setKeepAlive(false);
  </code></pre>
  
  <p>But this appears to change nothing. I am using wireshark to analyze the traffic. Here is a screen shot of wireshark... the black lines indicate where my client is asleep and it's receieve buffer is full. Can I stop the keepAlive packets from being sent by the server?</p>
  
  <p>Thanks! </p>