Your first assignment is to build a server capable of receiving text messages
from clients. The server should print these text messages on standard output.
From the server perspective, a message corresponds to the data received from a
particular client during a communication session with that client. The server
should be listening for text messages to a port known to the clients. The
server should be able to receive text messages from multiple clients. When
multiple clients simultaneously try to send text messages to the server, the
server should print them one at a time (in any order).
You should also implement a client to test the server. The client should
receive the text message from standard input. The end of the message is marked
by a control sequence which corresponds to hitting >ENTER< twice. This control
sequence is also an instruction for the client to exit. This control sequence
should not be transmitted.
This assignment should be completed in ANSI C or C++. It should compile and run
without errors in the FC 010 cluster producing two binaries called server and
client. The server should take as its first argument the port to listen to. The
client should take as its first argument the name of the host that the server
is running and the port that the server is listening. If the server cannot bind
to the port that you specify, a message should be printed on standard error and
the program should exit. You shouldn't assume that your server will be running
on a particular IP address, or that clients will be coming from a predetermined
You should test your code with long text messages (of size at least 20KB), not
just short ones. You can use pipes to redirect the standard input of the client
and standard output of the server. You should also test your code with multiple
The deliverables are two files: "server.c" and "client.c" implementing the
server and client as described above and a makefile for producing the
executables. These files should be sent to iavramop at princeton dot edu.