'How to handle keep alive received probe on python server
In a python-written server with TCP socket defined as follows:
def create_tcp_socket(bind_address):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(bind_address)
return sock
[...]
sock.accept()
sock.settimeout(SOCK_TIMEOUT)
I'd like to handle the keep-alive probe so to reset the timeout if the client is sending keep-alive probes. Currently, with the above implementation, keepalive probes are acknowledged but still, the server is dropping and closing the connection with a FIN once SOCK_TIMEOUT
expires.
Is there a way in the socket python library to handle the keepalive functionality?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|