The usual Python HTTP server never stops

The usual Python HTTP server never stops. Since there is the timout option in the socket module, there is an easy way to do a clean shutdown of a running server.


Override the server_bind method to set a timeout on the main socket. Then override the get_request and serve methods to break if the attribute run is set to False.

This Method can be used for all types of servers based on the SocketServer module.

Reference:
>>  Simple XML serlializer/de-serializer using Python dictionaries and marshalling

Content Team

The IndicThreads Content Team posts news about the latest and greatest in software development as well as content from IndicThreads' conferences and events. Track us social media @IndicThreads. Stay tuned!

Leave a Reply