January 2019
Beginner to intermediate
776 pages
19h 58m
English
In this recipe, we created the CustomHTTPServer class inherited from the HTTPServer class. In the constructor method, the CustomHTTPServer class sets up the server address and port received as a user input. In the constructor, our web server's RequestHandler class has been set up. Every time a client is connected, the server handles the request according to this class.
The RequestHandler defines the action to handle the client's GET request. It sends an HTTP header (code 200) with a success message Hello from server! using the write() method.
Read now
Unlock full access