title: How to change tcp keepalive timer using python script?
body: <p>In my python script, I have activate TCP Keepalive using this command:</p>
  
  <pre><code>x = s.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
  </code></pre>
  
  <p>My goal is for socket connection to get closed, if there is no transmission(*) for 5 minutes. I am working on Windows and my python script is only receiving and not transmitting any data to client program.</p>
  
  <p>What I know is, by default, if no transmission will be there for 2 hours, then only I can close the connection using try and except. I know, for windows, I can manually reduce this waiting time by going to registry. But is there is a way by which, I can modify it from my script?</p>
  
  <p>(*) here "no transmission" means "something quietly eats packets on the network" rather than "I'm not trying to send anything."</p>