Final Exam

You are tasked with writing a client that connects and communicates with a running server.  The server information is below.

  • Server IP address: 23.22.136.170
  • Port: 8902
  • Service name: final

To complete this exam you will need to edit your /etc/services file.

Source code

Please log into your AWS server and create a folder named final in your Git repository.  Include all of your source code for this exam in the final folder and push the folder to Github at the end of the exam period or when you are finished.

Before leaving, please check GitHub.com to be certain that your files were successfully added to your repository.

Protocol

The server uses the following protocol.

  • Client sends an 8 bytes string containing your username.
  • Server sends 16 bytes containing a null terminated string holding your IP address.
  • Client sends a 4 byte integer whose value is the sum of the numbers separated by dots in the IP address.
  • If the sum is correct, the server sends a 256 byte null terminated string containing a quote.

Grading Rubric

  • 5 points if your program is well formatted and includes proper error checking.
  • 20 points if the server receives your username from your client.
  • 20 points if your client prints to the console the IP address received from the server.
  • 20 points if the server receives the correct sum from your client.
  • 15 points if you include a README file that contains the quote sent from the server.
  • 5 points if your client gracefully terminates using a signal handler for SIGINT.
  • 5 points if your client uses the string read from the server (containing the IP address) to compute the sum.
  • 10 points if your client uses a thread to compute the sum.

Students that submit programs that do not compile or that get segmentation faults will receive a grade of 0.  Therefore, before pushing your code to GitHub, please be sure to comment out all blocks of code that can not be compile or that produced segmentation faults.

Restrictions on Computer Use

You may view any resources available on the internet during this exam.  You may not, however, communicate with anyone, anonymous or not, in order to receive or give help.  When in doubt, raise your hand and ask.

Good Luck!

 

© 2019, Eric. All rights reserved.