I'll explain you better my problem. 
I've code a simple python server who listening for web client connection. 
The server is running but i must add a function and i don't know how resolve this..
I must set up a timer, if the client don't connect every N seconds, I've to log it.
I already looked for set up a timeout but in the lib socket, the timeout doesn't do what i want ...
I tried to set up a timer with timestamps and compare values, but the socket.listen() method don't stop operation until a client connects. And i wanna stop the listen() method if the time is exceeded.
How about using a token that is switched when the client connects? Put it in a while loop and if the token is ever the same non-switched value twice in a row kill the loop and stop listen().
Python set up a timer for client connection