Python Network Programming
by Abhishek Ratan, Eric Chou, Pradeeban Kathiravelu, Dr. M. O. Faruque Sarker
How it works...
In this recipe, we have created a ServerThread subclass inheriting from the Python threading library's thread class. This subclass initializes a server attribute that creates an instance of the SimpleXMLRPC server. The XML-RPC server address can be given through the command-line input. In order to enable the multicall function, we called the register_multicall_functions() method on the server instance.
Then, four trivial functions are registered with this XML-RPC server: add(), subtract(), multiply(), and divide().
These functions do exactly the same operation as their names suggest.
In order to launch the server, we pass a host and port to the run_server() function. A server instance is created using the ServerThread class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access