This project must be written in C and must compile and run on one of the RHEL boxes in the berry patch (click here for a list of available machines).
You will create a simple TCP network client with functionality similar to a stripped-down raw-TCP telnet. Your client will send text specified on the command line to a server, and then print to the console the response received.
We will use the term client to mean an application which initiates connections to servers and makes requests. Your web browser and instant message program are examples of clients. We will use server to mean an application which accepts connections from clients. Servers service requests from clients and send back responses.
You will learn about the socket abstraction for building network applications. A socket hides the protocol layer from the programmer, exposing instead a read/write interface that should be familiar if you have read from and written to files. In fact, sockets use the file descriptor interface.
You will use TCP to make the connection between client and server. TCP is a stream-oriented, reliable-transport protocol. This means that once a connection is established, requests and responses can be reliably sent and recieved using the connection's socket. We'll learn more about TCP when we study communication abstractions and networking.
Your client will do the following when invoked:
A blocking client will wait indefinitely for a response from a server. A full-strength TCP client implementation is typically non-blocking, i.e., it handles asynchronous events by polling sockets to see if more data can be sent or received. A problem with blocking clients is that they can appear to hang if a server refuses to reply to its request; you can ignore this problem for now. We will learn how to write non-blocking network applications later in the term.
Your client program will be named sc, and will be invoked on the command line like this:
./sc host port command
For example:
./sc www.brandeis.edu 80 "GET /"
We recommend that you develop on a Linux machine. You can log into any of the Brandeis CS department public machines to work, or you can work in the berry patch. You are also free to develop on your own computer, but be aware that in order to receive credit your assignment must compile and run on one of the RHEL machines in the berry patch.
Download and unpack sc.zip. At the Linux command line, you can unpack it with the following command:
unzip sc.zip
In Linux, to build sc, execute the following on the command line while in the sc directory:
make
This will build the sc binary, which you can run as described above. The skeleton sc.c does nothing, you will have to add to it all the required content to solve the assignment. As you are developing, you can rebuild sc simply by typing make on the command line again.
./sc www.brandeis.edu 80 "GET /"
telnet www.brandeis.edu 80 Trying 129.64.99.138... Connected to arachne.unet.brandeis.edu. Escape character is '^]'. GET /
Submission instructions have appeared in the FAQ.