CpSc 3600-001 Homework 5: RPC Client/Server Program solution

$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (2 votes)

This project is to write RPC client and server programs in C or C++.  Your programs should have the following functions:

RPC Name Server

Your name server will maintain a configuration file that store information, like name, hostname, about other RPC servers. The name server will have two functions. One is for other RPC servers to register with Name Server. The other is for RPC clients to get hostname about RPC servers by their name. When there is a RPC server register with Name server, it will update the configuration file. When there is a request from client, it will read the information from configuration file. Here are functions/procedures needed to implemented by Name server.

int registerServer(char [] name, char[] hostname);

int removeServer(char[] name);

string getServerHostName(char [] name);

Below is an example of a command line that could be used to run your RPC Name server:

./NameServer

RPC File Server

Your RPC File Server will be a server for client to retrieve files and a client of RPC Name Server. When your RPC File Server starts, it will first run as a RPC client to register its hostname to RPC name server. You can implement the File server in two processes. Your parent process will be the RPC client to the Name server. After registering with Name server, you will use fork() to create a child process to execute the RPC file server function. The file sever will be an iterative server and it will handle one client a time. The File server will only have one function to let client get a file by its name:

string getFile ( char [] name);

Below is an example of a command line that could be used to run RPC File server:

./FileServer spider2.cs.clemson.edu

The first command line parameter (argv[1]) must be the host name of RPC Name server.

RPC Client

Your RPC Client will be both client to RPC name server and RPC file server. The RPC Client will first be a client of RPC Name server and call a remote procedure to get the hostname about the RPC file server. Then, the RPC client will be a client of RPC file server to retrieve a file. The file name will pass through arguments of RPC Client.

Below is an example of a command line that could be used to run your RPC client and require a file specified by “myfile”:

./client  spider2.cs.clemson.edu  FileServer myfile

The first command line parameter (argv[1]) must be the host name of RPC Name server.
The second parameter (argv[2]) is the name of the the file server.
The third parameter (argv[3]) is the name of the ASCII file to be retrieve from the file server.

Deliverables

You must submit all the source code necessary for us to build and test your RPC client and server. These files must include two server programs and one client program. You must also include Makefile that can be used to build your client and server on the CS Linux workstations.

You must also include in your submission a file named README that includes your name and a brief description of your submission, including the name of each file submitted along with a one line description of what is in the file. If your code is not complete, tell us what works and what doesn’t. If you are submitting code that does not compile, please tell us that as well. If any of your code was written by someone else, you are required to tell us about it (this must also be documented in the code itself). Finally, feel free to include a description of any problems you had or anything else you think might be helpful to us.

Grading

Your project will be tested to make sure it works properly. Here is a rough breakdown of the grading:

RPC Name Server 20%
RPC File Server 30%
RPC Client 30%
Error handling, Style/Code structure, etc. 20%

NOTE: 20% of your homework grade depends on the how “well your code is written”. These points include the following:

  • Error handling (check every system call for an error!).
  • Safe code (avoiding buffer overflow, etc).
  • How well we can understand your code. There is no required format for your code, there is no requirement like “you must have one comment for every 5 lines of code”. Feel free to provide whatever level of commenting you believe is appropriate to make sure that other competent programmers could easily understand and make changes to your code.

Submitting your files

All projects must be submitted via handin: https://handin.cs.clemson.eduPlease make sure you submit all your source files not the object files.  You can also zip the files using the following command first:

          > tar   cvzf   hw5.tgz   file1  file2   file3  …

and submit the single zip file hw6.tgz.  Before you submit this single file, please use the following command to check make sure you have everything in this zip file:

            > tar   tvzf   hw5.tgz

Don’t send compiled code! Please ask question if you don’t understand any part of this project.

Resources/Links:  Please see the sample codes of the book.