title: When is a TCP connection considered idle?
body: <p>I have a requirement to enable TCP keepalive on any connections and now I am struggling with the results from our test case. I think this is because I do not really understand when the first keepalive probe is sent. I read the following in the documentation for <code>tcp_keepalive_time</code> on Linux:</p>
  
  <blockquote>
    <p>the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the
    connection is marked to need keepalive, this counter is not used any
    further</p>
  </blockquote>
  
  <p>Some other sources state that this is the time a connection is idle, but they do not further define what this means. I also looked into Stevens to find a more formal definition of this, because I am wondering what "the last data packet sent" actually means when considering retransmissions. </p>
  
  <p>In my test case, I have a connection where data is only sent from a server to a client at rather high rates. To test keepalive, we unplugged the cable on the client's NIC. I can now see that the network stack tries to send the data and enters the retransmission state, but no keep alive probe is sent. Is it correct that keep alive probes are not sent during retransmission?</p>