Question: In this project, you'll write a client that will use sockets to communicate with a server that you will also write. Here's what your client

In this project, you'll write a client that will use sockets to communicate with a server that you will also write. Here's what your client and server should do:
Your client should first accept an integer between 1 and 100 from the keyboard, open a TCP socket to your server and send a message containing (i) a string containing your name (e.g.,
"Client of John Q. Smith) and (ii) the entered integer value and then wait for a sever reply.
Your server will create a string containing its name (e.g., "Server of John Q. Smith") and then begin accepting connections from clients. On receipt of a client message, your server should
i. print (display) the client's name (extracted from the received message) and the server's name
ii.
itself pick an integer between 1 and 100(it's fine for the server to use the same number all the time) and display the client's number, its number, and the sum of those numbers
ili.
send its name string and the server-chosen integer value back to the client
iv.
if your server receives an integer value that is out of range, it should terminate after releasing any created sockets. You can use this to shut down your server.
Your client should read the message sent by the server and display its name, the server's name, its integer value, and the server's integer value, and then compute and the sum. The client then terminates after releasing any created sockets. As an aside (and as a check that you are doing things correctly, you should make sure for yourself that the values and the sums are correct!)
Note that if you've got your own client and server running, there isn't any more programming involved - just running your client and server with someone else's. For this part of the project, you need only hand in the output from your "wide" - the client or the server, since
Sorer s practing Kcal ha Fien we citused sundad tof prtecs we noted hat th e"
IETF requires that two independent implementations of a protocol must interoperate; that's what you are doing here. Again, make sure to check that your numbers and sums are correct.
How to Hand In Project
Note that a short design document is required. You should program your client and server to each print an informative statement whenever it takes an action (e.g., sends or receives a message, detects termination of input, etc.), so that you can see that your processes are working correctly (or not!). This also allows the TA to also determine from this output if your processes are working correctly. You should hand in screen shots (or file content, if your process is writing to a file) of these informative messages as well as the required output of the client and server (name strings, integer values and sums)

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