Question: Requires you to develop two Python programs. One is a client, the other is the server. Server The server should register x procedures that the

 Requires you to develop two Python programs. One is a client, the other is the server.

Server

The server should “register” x procedures that the client will be able to call. It will then bind to the address “localhost” and port 8000. This is the address and port that the server will listen to for requests. Note that if you have binding errors, you may use another port as your computer may have an application that is using 8000. Most of the time, however, this will work. Your server invocation must be in the following form:

python server.py localhost 8000


These procedures to be supported are as follows:

name – returns the name of the server which is passed on the commandline during server invocation

help – returns a list of procedures that the server supports

servertime – returns the current time at the server in 24 hour format. I.e. 13:00:01

add(x,y) – returns the sum of x and y

sub(x,y) – returns x – y

mult(x,y) – returns x * y

div(x,y) – returns x/y

 

Client

The client is to connect to the server using the server’s address and the port that the server is listening on (see above). It then will exercise each of the supported procedures using the values 8 and 6 for the values x and y respectively. Your client invocation must be in the following form:

python client.py host_address host_port 8 6

Where host_address and host_port are the address and port that the server is listening on. If you are using a single computer for server and client computers just use “localhost” for the address and the port used above. The 8 and the 6 are the values for x and y.

 

Example Output Of Client:

 

8 * 6 is 48.0

8 / 6 is 1.3333333333333333

8 + 6 is 14.0

8 - 6 is 2.0

8 / 0 is Infinity

13:50:22

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Server import socket class Server def initself host port selfhost host selfport port selfsocket sock... View full answer

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 Programming Questions!