See the attached question file with instruction language is c++

CIS527 Fall 2022 Programming Assignment 1

Online Address Book

  1. Introduction

This programming assignment is designed to let you familiar with the socket interface and client-server application. This assignment weights 10 % of your final grade.

For this assignment, you will design and implement an online address book application using network sockets. You will write both the client and server portions of this application. You may use the provided sample programs as the codebases. The client and server processes will communicate using TCP sockets and will implement the protocol discussed below.

  1. The Assignment 1

You will write two programs, a server and a client. The server creates a socket in the Internet domain bound to port SERVER_PORT (a constant you should define in both programs, you may use last 4 digits of your UM-ID). The server receives requests through this socket, acts on those requests, and returns the results to the requester. The client will also create a socket in the Internet domain, send requests to the SERVER_PORT of a computer specified on the command-line, and receive responses through this socket from a server.

For this assignment, you just need to allow one active client connect to the server. In the next assignment, you should allow multiple clients connect the server at the same time.

Your client and server should operate as follows. Your server begins execution by opening a file that you have created and that contains the address book. Each record in the address book will have four fields, Record ID (4 digits), First Name (up to 8 characters), Last Name (up to 8 characters), Phone Number (12 characters). Your server should read these records into a server-internal data structure and keep track of the number of records. You may assume that you will never have to store more than some fixed number, say 20, records. Once the server has initialized its data structures, it should wait for the connection requests from the clients.

Your client operates by sending an ADD, DELETE, LIST, SHUDOWN, QUIT commands to the server. You should create a client that is able to send any of the five commands above, and allows a user to specify which of the commands the client should send to the server.

The details of the protocol depend on the command the client sends to the server.

ADD

Add a name and number record to the address book. A client sends the ASCII string “ADD" followed by a space, followed by a First Name, followed by a space, followed by a Last Name, followed by a space, followed by a Phone Number, and followed by the newline character (i.e., '\n').

When the server receives an ADD command from a client, it will add a new record in the address book and return the “200 OK” message.

A client-server interaction with the ADD command thus looks like:

c: ADD Jinhua Guo 313-583-6439

s: 200 OK

The new Record ID is 1001

DELETE

Delete a record from the address book. A client that sends the ASCII string "DELETE", followed by a space, followed by a Record ID, followed by the newline character (i.e., '\n'). The client should then wait for the server to return a "200 OK" message (indicating that the record is successfully deleted), or a "403 The Record ID does not exist."

A client-server interaction with the DELETE command thus looks like:

c: DELETE 1001
s: 200 OK

LIST

List all records in the address book.

A client-server interaction with the LIST command looks like:

c: LIST

s: 200 OK

The list of records in the book:

1001 Jinhua Guo 313-583-6439

1002 John Smith 313-583-1234

1003 Mary Miller 313-594-4567

SHUTDOWN

The SHUTDOWN command, which is sent from the client to the server, is a single line message that allows a user to shutdown the server. A user that wants to shutdown the server should send the ASCII string "SHUTDOWN" followed by the newline character (i.e., '\n').

Upon receiving the SHUTDOWN command, the server should return the string "200 OK" (terminated with a newline), close all open sockets and files, and then terminate.

A client-server interaction with the SHUTDOWN command looks like:

c: SHUTDOWN
s: 200 OK

QUIT

Terminate only the client. The client exits when it receives the confirmation message from the server.

A client-server interaction with the QUIT command looks like:

c: QUIT

s: 200 OK

Note, “300 invalid command” or “301 message format error” should be returned to the client, if a server receives an invalid command or the command in the wrong format.

  1. Format

You should form a team of two students (or work individually) and then jointly design your project. While each project should be an integrated effort, you should identify in your README file what part of the project each member is responsible for.


Note, please form your group as soon as possible. Every student needs to sign up for one of the programming groups on canvas no later than 10/6.

  1. Programming Environment

You can use either C/C++ or Java to implement the assignments. The assignments will be tested on the UMD Login servers (login.umd.umich.edu). For easy grading, please don’t use any GUI interface.

  1. Requirements

The following items are required for full-credit:

  • implement all five commands: ADD, DELETE, LIST, QUIT, SHUTDOWN

  • both the server and client should be able to run on any UMD login servers.

  • make sure that you do sufficient error handling such that a user can't crash your server. For instance, what will you do if a user provides invalid input?

  • the server IP address should be a command line parameter for the client program.

  • the server should print out all messages received from clients on the screen.

  • when the previous client exits, the server should allow the next client connect.

  • your source codes must be commented

  • include a README file in your submission.

  • include a Makefile in your submission.

Note 1, the README file should be a plain text file. In your README file, the following information should be included: the commands that you have been implemented, the instructions about how to compile and run your program, any known problems or bugs, and sample outputs.

Note 2, your Makefile could be the exactly same as the sample Makefile if you do not change the file names of the sample codes.

  1. Grading (100 points)

  • Correctness and Robustness (90 points)

    • You will lose at least 10 points for any bugs that cause the system crash.

    • You will lose at least 5 points for any other bugs.

  • Comments and style (5 points)

  • README and Makefile (5 points)

  1. Submission Instruction

(1) Copy all your files (only source codes, data file, README, and Makefile, no object file and executable file) in a directory.  The directory should be named like lastname_firstnameinitial_p1.  For example, if you name is John Smith, your directory name should smith_j_p1.
(2) Generate a tar file of the directory using the following command. Enter the parent directory of your current directory and type
tar cvf lastname_firstnameinitial_p1.tar lastname_firstnameinitial_p1
For example
    tar cvf smith_j_p1.tar smith_j_p1

Note, only the tar file will be accepted. You are fully responsible for generating the right tar file.


(3) Submit the tar file to the canvas website “P1” assignment folder.

  1. Hints

  • The sample programs (both C/C++ and java) are available on Canvas, under Files->P1 folder.

  • Start early. These programs will not be very long, but they may be difficult to write, and they will certainly be difficult to debug.

  • SSH

Mac OS and Linux come with a ssh client you can run from a Terminal. You do not need to install anything. Microsoft Windows users may download the SSH software, from the following site: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  • Accessing the UM-Dearborn Home Drive

https://umdearborn.teamdynamix.com/TDClient/2019/Portal/KB/ArticleDet?ID=42879