


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Bhattacharjee; Class: Computer Networks; Subject: Computer Science; University: University of Maryland; Term: Spring 2009;
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



CMSC 417 Computer Networks Spring 2009
Assigned: 01/30/2009 Due: 02/04/2009, 11:59:59 PM.
You should use the CSIC Linux cluster systems and obtain your account information from the TA.
For this assignment, you will write a client program which will communicate using sockets with a server program provided by us. We will give you a a sketch of the client program — all you have to do is fill in socket-specific bits. For each client request, our server generates and returns two cookies, and then the server and client embark on a long goodbye. Obviously, the protocol is trivial/useless, however, this exercise will get you started on the cluster and familiarize you with sockets, network programming and distributed debugging.
The server runs on the machine SERVER HOSTNAME and listens for requests on a TCP socket bound to port SERVER PORT. Both constants are defined in the header file provided for you. This exercise has four types of messages: HELLO, STATUS, BYE and CONFIRM BYE. Each message is an ASCII string, and consists of multiple fields separated by spaces (0x20). The maximum length of each message is MAX STR SIZE, which is also defined in the header file given to you.
HELLO
STATUS
BYE
CONFIRM_BYE
Figure 1: protocol outline
The protocol outline is given in Fig 1. The client initiates the protocol by sending a HELLO message to the server. The server replies with a STATUS message. The client then sends a BYE message, and the server terminates the connection by sending a CONFIRM BYE message. A
connection is successful if and only if all of these messages are correctly sent and received. Since we are using TCP for communication in this assignment, you do not have to worry about lost messages etc.; you only need to ensure that all messages are sent correctly (and that you receive and parse messages correctly). The details of each message are as follows:
An example HELLO message might look like this:
HELLO cmsc417spring09 cs417000 Huang
An example STATUS message might be: STATUS cmsc417spring09 356 478 128.8.128.153:
expected, such as an incorrect magic string or wrong message type, assert an error and terminate your program. Your code must be -Wall clean on gcc. Do not ask the TA for help on (or post to the forum) code that is not -Wall clean unless getting rid of the warning is what the problem is in the first place.