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.
Latest posts by Content Team (see all)
- IndicThreads Pune 2016 To Equip Developers For A New Age Of Software Development - May 27, 2016
- Java Garbage Collectors – Moving to Garbage First (G1) Collector - May 25, 2016
- Using Lambdas and Streams in Java 8 - May 18, 2016