

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
The first programming assignment for the computer networks course (cmsc 417) at the university. Students are required to write a client program that communicates with a server using sockets and tcp. The protocol involves sending and receiving specific messages with defined fields, including a magic string and message type. The assignment aims to familiarize students with network programming and distributed debugging.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


CMSC 417 Computer Networks Fall 2007
Assigned: Sep 5th Due: Sep 12th, 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 a random number, 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, CLIENT BYE and SERVER BYE. Each message is an ASCII string, and consists of multiple fields seperated by whitespace (space (0x20) or newline (0x0a) character). The MAXIMUM length of the string is 255. 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 CLIENT BYE message, and the server terminates the connection by sending a SERVER 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:
cmsc417fall2007 HELLO cs417000 Kan-Leung. Note that the TA’s first name (Kan Leung) contained a space, but we’ve replaced it with a hyphen. If your name contains a newline or tab, replace those with a hyphen as well.
The STATUS message has 4 fields in the following order:
An example STATUS message might be: cmsc417fall2007 STATUS 42 128.8.128.153:
The CLIENT BYE message has 3 fields in the following order:
An example CLIENT BYE message would be: cmsc417fall2007 CLIENT_BYE 42
The SERVER BYE message has 2 fields in the following order: