Question: Use BOTH methods (1) Socket-API, (2) XML-RPC and python programming language. References: Socket Python https://docs.python.org/2/howto/sockets.html XML-RPC Python2 https://docs.python.org/2/library/xmlrpclib.html Python3 https://docs.python.org/3/library/xmlrpc.client.html Please write 1) your source

Use BOTHmethods (1) Socket-API, (2) XML-RPC and python programming language.

References:

Socket

Python https://docs.python.org/2/howto/sockets.html

XML-RPC

Python2 https://docs.python.org/2/library/xmlrpclib.html

Python3 https://docs.python.org/3/library/xmlrpc.client.html

Please write 1) your source code, and 2) a report with screenshots, description of your code, and answers to the writing problems.

Q1-1. Programming Problem

Implement a service with the following functionalities: 1) If the client sends a string message, server simply replies with I have received your message XXX(message content). 2) If the client sends a request to add multiple numbers, server replies with the result.

Examples:

Client sends: Hello There!

Server replies: I have received your message Hello There!

Client sends: Add,[1,2,3,4,5]

Server replies: Sum([1,2,3,4,5]) = 15 (The format could be flexible. Its fine if the server only returns 15)

Client sends: Add,[1,2,3]

Server replies: Sum([1,2,3]) = 6

NOTE: The messages from client or server should be generated by client/server, not printed at the other side.

Hint: In socket programming, client sends a request in the format , if TYPE=0, we get MESSAGE; if TYPE=1, MESSAGE contains a list of the numbers.

Please include screenshots of your results and the command you use to run the code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!