Due: May 1 (By 11:59pm)


There are a number of objectives to this assignment. The first is to make sure you have some experience actually doing a simple socket programming assignment. Second, it will help you “tune up” your programming skills and prepare you for the other upper-division networking courses. Third, because you are allowed to use any references you find on the Internet (including copies of existing code!), this assignment will help you see just how many network programming aids are available via the web. And finally, having just a bit of practical experience will put a lot of the protocol concepts we learn into perspective.

Assignment Details

The goal of this assignment is to implement a TCP client and server, and a UDP client and server (for a total of four different programs). You can use either C or Java (there will be a bit of extra credit for C since it requires slightly more work, and more attention to detail). Your TCP or UDP client/server will communicate over the network and exchange data.

The server will start in passive mode listening on a specified port for a transmission from a client. Separately, the client will be started and will contact the server on a given IP address and port number that must be entered via the command line.

The client should start with the string "Enter command:". It should accept a single keypress as input. The single key should be a "1", "2", or "3". The client should ensure that no other input is accepted. This digit should then be sent to the server. The server should take the following actions:

In all cases, upon receiving a response from the server, the client should display the returned text. For the first two commands, after receiving a response, the client should again display: "Enter command:". In the third case, the client should exit.

See below for the output from a sample run.