In my python script, I have activate TCP Keepalive using this command:
x = s.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
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.
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?
(*) here "no transmission" means "something quietly eats packets on the network" rather than "I'm not trying to send anything."