In this assignment you will modify your Assignment 4 so that the server and client use network communication.
We have organized this assignment so that the communication is isolated from the rest of the processing. That way when we start communicating between processes on different machines we can reuse most of Assignment 4 and just modify the client and the server. You can base your client and server on the ones discussed in class, the programs client.c and server.c from Chapter 18 of USP.
Part 0: Getting Started
If you have not already done so, finish through Part 4 of Assignment 4.
Make copies and put all of the programs in a new directory.
Part 1: Get the following programs from Chapter 18 of USP.
Put these in the same directory as your programs in Part 0 of this
assignment. Modify your makefile so that it can compile and run the
new client and server. Make sure the client and server can communicate with
each other. Note that you may have to change the names of the client and
server programs you wore for Assignment 4 if you called them client
and server.
Part 2: Write a network client.
Rewrite the client of Assignment 4 so that it takes three command line
parameters, a host name, a port number and a directory.
This will be a combination of the client from Assignment 4 and the client
Chapter 18 of USP. It will behave
like the client of Assignment 4, except that it will make a connection
to a server running on the host machine using the given port. For testing,
use the port numbers assigned to you during the recitation. A list
of these port number can be found here.
Part 3: Write the network server.
The server takes a single command line parameter, the port it is to
listen on. When a connection is made, handle it as in Assignment 4.
Base this program on the serial server from Chapter 18 of USP that you
used in Part 1 of this assignment.
Note: if you cannot get your client from Part 2 to communicate with your server of Part 3, you can try your client of Part 2 with the program serverp2.c from Chapter 18 of USP and your server from Part 3 with the client2 from Chapter 18 of USP.
Handing in your assignment
Test the programs as you did with Assignment 4.
Use this cover sheet for this assignment.
Again, you need to convince me that your programs are working correctly.
In addition, you will be demonstrating you programs in the lab on
Wednesday, November 29.
Instructions for this are available
here.