CPSC 441: Computer Networks

Fall 2021

Assignment 0: Client-Server Testing (0 marks)

Due: Friday, September 17, 2021 (11:59pm)

Learning Objectives

The purpose of this assignment is to learn about client-server socket programming.

Preamble

On the Internet, there is a simple CPSC 441 test server running on csx1.cpsc.ucalgary.ca (IP 136.159.5.25) on TCP port 44101. You can verify its existence using the telnet command as demonstrated in class. Your goal in this warm-up assignment is to write a simple client-side program that can talk to this server using a TCP socket. This practice exercise will help you get started with the (much more complicated) socket programming required for Assignment 1.

Background

Most network applications are written using a client-server paradigm. The server is a special entity that runs forever, listening for clients that make requests for its specific service. Clients are ordinary users (or computers) who send requests to the server asking for service. Here is an example of the C code for the CPSC 441 test server. Your task is to write the code for a client that can talk to this server using TCP.

Technical Requirements

In this assignment, you will implement your very own client program to talk to the CPSC 441 test server. You can do so using either C or C++ (perhaps both!).

There are three main pieces of functionality needed in your client. First, it needs to establish a TCP connection to talk to the server. Second, it needs to exchange one or more commands with the server, presumably in a loop to support client-server interaction from the user. Finally, once the client is all done, it needs to gracefully close the TCP connection that it was using.

When you are finished, please show your solution to your TA in your tutorial section. You do NOT need to upload anything into D2L for this one.

Testing

You can test your client using the following commands:

  1. HELLO: a polite application-level opening handshake between client and server;
  2. HELP: a query to see what basic commands the server supports;
  3. COUNT: a query to see how busy the CPSC 441 test server has been;
  4. INFO: a query to show what IP address and port the client is using;
  5. BYE: a polite application-level closing handshake between client and server.

Good luck, and have fun!

Grading Rubric

The grading scheme for the assignment is as follows:

Bonus (optional, 0 marks)

There might be a few other commands that the server supports, but these are undocumented. If you find some, make sure to mention this during your demo.

Tips