cp /tmp/echolab.tar ~/csc2405
cd ~/csc2405 tar xvf echolab.tarThis will cause a number of files to be unpacked in your directory echolab:
|echoserver.c||C code for a sequential echo server|
|echoclient.c||C code for an echo client|
|nethelp.c||File containing helper functions|
|nethelp.h||Header file for functions defined in nethelp.c|
|Makefile||Compiles and links together nethelp.c and a source file|
./echoserver NOpen a separate window to test the server with telnet first. You'll need to pass to the client the name of the machine on which the server runs -- for example, if working on degas, type in
telnet degas NNext test both the echo client and echo server and by having them communicate with each other. Restart your server, then in a different terminal type in
./echoclient degas NNow anything you type into the client window will be sent over the connection and echoed back to you by the server.
123 server received 4 bytes 321
Note that the server will have to pass to the thread the file descriptor for the connection returned by the accept system call, so that the thread can use it in its communication with the client.
To test your multithreaded server, open two client windows and have the clients talk simultaneously to the server.