Write a server socket capable of receiving an integer choice variable and two integer values from clients. The server should implement a thread that performs different operations on the integers based on the choice received from the client and send the results back to the client. The server should be listening on a port known to the clients and should handle the client connections sequentially and accept connections from 5 clients. The client socket should read a choice (user a menu) and two integers from the user, transmit the three variables to the server and wait for results. Once results arrive, it should display the results. The choices are as follows: Choice :1 Operation: add the two integers Choice :2 Operation: multiply the two integers Choice :3 Operation: subtract the two integers Choice :4 Terminate/close the connection
Write a server socket capable of receiving an integer choice variable and two integer values from clients. The server should implement a thread that performs different operations on the integers based on the choice received from the client and send the results back to the client.
The server should be listening on a port known to the clients and should handle the client connections sequentially and accept connections from 5 clients.
The client socket should read a choice (user a menu) and two integers from the user, transmit the three variables to the server and wait for results. Once results arrive, it should display the results.
The choices are as follows:
Choice :1 Operation: add the two integers
Choice :2 Operation: multiply the two integers
Choice :3 Operation: subtract the two integers
Choice :4 Terminate/close the connection
Step by step
Solved in 3 steps with 12 images