Socket server and libraries

For this assignment you are going to write a simple chat server. The server is going to accept two client connections and then relay the input data to the other client.

The server port will be the first command line argument. We will use telnet as the client. It should run until one of the clients starts a line with "quit" ( or the telnet escape character '^]' ). At that point all of the socket must be closed correctly.

The library

You also need to put all of your sockets and file descriptor code in a library. What I want is a library containing all of the code related to sockets and any file descriptor I/O. This will make this code easier to reuse in the future.

The program must use library functions to do all sockets and I/O operations. This means no calls to socket, bind, listen, accept, read, or write will be in your program.

NOTE: When data is sent with telnet each line will end with carriage return and newline ( no NULL ). Send it back that way or it may not display correctly on the client.

VERY IMPORTANT NOTE: As long as the descriptor for a socket is in use do NOT let the sockaddr(s) go out of scope. This will require some type of storage that maps file descriptor to the sockaddr pointer, and is persistant for multiple sockaddr(s) since there will be multiple connections.


Your makefile needs to build the library and the program from source, it needs to build the library as static, and link the library correctly ( read as : do not link the .o for it ).

This is due on November 10th.

The Goals