PA5: The Data Server Moved Out! solved




In this Programming Assignment, you are going to add another class called NetworkRequestChannel to
provide communication across the network over TCP/IP. Specifically, you allow the client-side end of a
request channel to reside on one machine, and the server-side end of the channel on another machine.
The communication over a request channel is to be provided by TCP connection(s). In order to establish
request channels over the network, the interface of the request channel must be modified some what
and you can do so.
First, you are to modify the data server program from PA3 to handle incoming requests over network
request channels instead of FIFORequestChannels. The data server must be able to handle multiple
request channels, either from the same client or from different clients, possibly on different machines.
You also must modify the client from PA3 to send requests over network request channels.
The Assignment
You are to write a program (call it client.cpp) that consist of p patient threads, w worker threads, and file
transfer using TCP/IP request channels. Then write your dataserver.cpp so that multiple instances of the
client program, either from the same or from different client machines, can connect to the dataserver
simultaneously. The client program is to be called in the following form for data requests:
./client -n <#reqs> -w <# workers> -b -p <#patients> -h
-r Or, like the following for file requests:
./client -n <#reqs> -w <# workers> -b -f -h
-r The data server is to be called in the following form: ./dataserver -r Note that you the dataserver no longer runs using exec() function from the client. Rather, it is run in the
terminal in a different machine, or a different terminal in the same machine as well (i.e., TCP/IP also
works as an IPC method). The dataserver executable does not need the host name argument because it
runs the service in the current host.
What to Hand In
You are to hand in a .zip file that comprises the following files:
• All necessary code files and the makefile, even the ones that you did not modified since PA3
• Measure the performance of the system with varying numbers clients and write a report with
the runtime numbers presented in a graph (like the previous PAs).