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:
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.
Set your client and server to use a fixed port equal to ID If your classes login ends with numbers, just use that as your ID Example: cs will ID so port is If your ID ends with letters such as aa convert the left letter a b c and so on Then convert the right letter to a value from to a b and so on So csaa uses port And csbf must use port You must use your assigned port or you may have conflicts with other students.
Modify the first network example so that the client and server engage in backandforth 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
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
Advanced: modify the server to accept multiple clients and spawn readwrite 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
