Popular recipes by Rogier Steehouder http://code.activestate.com/recipes/users/1381917/2007-01-14T18:00:37-08:00ActiveState Code RecipesBaseHTTPServer with socket timeout (Python)
2007-01-14T18:00:37-08:00Rogier Steehouderhttp://code.activestate.com/recipes/users/1381917/http://code.activestate.com/recipes/499376-basehttpserver-with-socket-timeout/
<p style="color: grey">
Python
recipe 499376
by <a href="/recipes/users/1381917/">Rogier Steehouder</a>
.
Revision 2.
</p>
<p>BaseHTTPServer blocks while waiting for a connection. This means that a script will not respond to anything until it receives a network connection, which may never come. By adding a timeout to the listening socket, the script will regain control every so often.</p>