Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this TCP and UDP server and client please use Phyton and also add screenshots. Math Service via Network You are required to

Need help with this TCP and UDP server and client please use Phyton and also add screenshots.

Math Service via Network

You are required to implement a math server and a math client. The behaviors of the clients and server in this project are similar to that of the clients and server in Project 1. The client should allow the user to continuously issue requests until the user inputs Quit. The differences are:

1 Users will input some math expression, such as 2 + 3, 2 *3 , 2 + 3 * 4/5, etc., in the client. The client will send the math expression to the server.

2. The server will evaluate the result of the received math expression, and send back the final result back to the requesting client. The result should be sent back as a string. For example, if the server receives 2 + 3, it will send back 5. If the server receives 2 *3 , it will send back 6.

Basically, instead of sending strings and receiving capitalized strings, the client will send math expressions and receive the results of the math expressions. You can tell that this project is not very different from Project 1. You can potentially reuse some part of your original code.

On the server side, you need some evaluation function to evaluate a math expression. You can implement your own, or you can use some existing library functions/methods. In either case, your server should support valid math expressions that involve the four basic operators: +, -, *, and /. The math expressions can have an arbitrary number of spaces/tabs within them, and they should still be regarded as valid.

Requirements:

1. You are required to implement the UDP version. The UDP server should be able to serve multiple clients at the same time by default, without multi-threading.

2. You are required to implement the TCP non-persistent version. The TCP non-persistent server should be able to serve multiple clients at the same time by default, without multi-threading.

3. You are required to implement the TCP persistent version without multi-threading. The TCP persistent server should be able to serve multiple clients, not necessarily at the same time. That is, the server should be able to serve one client, and have several other clients pending while it is serving the first client. When the first client is done (quit gracefully), the server can pick up the next pending client and serve it; after this client is done, the server can again pick up the next pending client and serve it.

4. You are required to submit a project report. In your project report, you should include a comprehensive test to demonstrate that all your programs meet the requirements. For example, for the UDP version, your testing should show that your server really can serve multiple clients at the same time. You can include a screenshot with multiple clients concurrently running and getting the service. Also, show that when a client gracefully quits (by issuing Quit), other clients can still get the service without a problem, and new clients can come to get the service without a problem. The project report will have a large weight in terms of grading.

5. You are highly recommended to implement the TCP persistent version with multi-threading because you are required to implement multi-threading for the group project anyways. The multi-threaded TCP persistent server can serve multiple clients at the same time.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Is how things are said consistent with what is said?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago