Question: Requirements: 1 ) For this program, your files must compile via a working makefile using the make command. The network examples come with a make

Requirements:
1) For this program, your files must compile via a working makefile using the make command. The network examples come with a make file already setup so you may use that as is and just modifying the client and server programs. If you switch to a single program, make sure to modify the makefile accordingly. You must test your programs using multiple Putty instances, one for the server and one per client.
2) Set your client and server to use a fixed port equal to 30000+ ID. If your classes login ends with numbers, just use that as your ID. Example: cs330499 will ID=99 so port is 30000+99=30099. If your ID ends with letters such as aa, convert the left letter a=100, b=200, c=300 and so on. Then convert the right letter to a value from 1 to 26(a=1, b=2 and so on). So cs3304aa uses port 30000+100+1=30101. And cs3304bf must use port 30000+200+6=30206. You must use your assigned port or you may have conflicts with other students.
1) Modify the first network example so that the client and server engage in back-and-forth communication by putting the read and write code in a loop (recall both server and client can read from or write to the connection socket once established).
2) Notice that when either client or server is waiting for the user to input a message, it will block and thus cannot receive and print messages on the socket, and similarly while waiting to read from the socket, the user cannot input messages to send. Reprogram your client and server to handle reading and writing in separate threads to avoid this problem. This will allow each program to receive user or socket input asynchronously. Note: printf output sent to screen by the socket reading thread will interrupt partially typed user input (this is not correctable with the material weve learned this semester).
3) Advanced: modify the server to accept multiple clients and spawn read/write threads for each. Allow the clients to interact through the server such as implementing a game or simple chat server where the server passes messages from one client to other clients. Use mutex protected shared structures to share data among threads as needed.

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!