Question: In this project, you are required to implement a network application, which consists of a server and one or more clients. The server will provide
In this project, you are required to implement a network application, which consists of a server and one or more clients. The server will provide simple calculation services to the client(s). You should use both UDP sockets and TCP sockets to implement the communications between the server and the client(s).
Behavior on the client side:
The client program should be able to run in a forever while loop, so that the user can send as many calculation requests as he/she wants. The client program should provide two choices for the user: 1.) terminate the program, indicating that the user no longer needs to do any calculation this time. 2.) continue to input math expressions. The math expression is input as a string. You need to send the calculation request to the Simple Calculator Server using UDP socket and TCP socket. In this aspect, the message sending process is very similar to the example application we discussed in class.
Behavior on the server side:
The server should have a while loop that can continuously accept calculation requests. Server should understand at least the four operators, i.e., +, -, *, and /, when they appear alone. The result of a calculation request will be sent back to the corresponding requester as a string, which represents a number.
Four pieces of code are required: 1) UDP server code, 2) UDP client code, 3) TCP server code, 4) TCP client code. If you implement multi-threading in TCP, you should have at least one additional piece of code, i.e., TCP multithreaded server code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
