Part 0
Create a new directory and copy all of the files from
/usr/local/courses/cs3733/fall2001/uici/ into this directory.
Run make to compile the client and server and test these out
by running them on different machines. Anything typed at the client
should appear at the server.
Part 1
Create a new directory for this part.
Copy all of the files from Part 0 into this directory.
Rename serverp.c fileserver.c
and rename client.c fileget.c
and modify the makefile appropriately. Now modify these programs as follows:
Modify fileserver so that when a connection comes in, it reads a filename form the network. The name is terminated by a string terminator and no other input will come from the remote machine. If that file exists in the current directory, it sends that file to the remote host and closes the connection. If the file does not exist, or another error occurs before the file can be accessed, it just closes the remote connection without sending anything. This program is a parallel server that can handle multiple file requests.
Modify fileget so that it takes a third command line parameter, the name of a file. It attempts to create a file with the given name in the current directory if such a file does not already exist using the permissions 0600. If it cannot do this it terminates without initiating a connection. If the file creation is OK, it connects to the server and sends the name of the file as a string. It then reads from the network and writes everything it receives to the newly created file. When the connection is closed by the remote host, it closes the file and exits.
To test these programs, you must run fileget and fileserver
from different directories. One simple way of doing this is to create
a subdirectory for running fileget.
Do not test these programs by sending your source code from one to another.
Part 2
Create a new directory and copy all of the files from your Assignment 5
into this directory. Also copy uici.c and uici.h from Part 0.
Rename musicinfo.c musicinfoserver.c and change the makefile
accordingly. Modify musicinfoserver.c so that it takes exactly
one command line parameter, a port number. Make it act as a serial
UICI server as in the server.c program from Part 0. Do not
try to make it a parallel server.
It starts by creating a listenfd and then goes into an infinite
loop. In this loop it waits for a connection request, obtaining a
communfd file descriptor. It then acts as in Assignment 5, using
this file descriptor in place of the two pipes. After receiving a command
and sending the result, it closes the connection and waits for a new request.
Get this to lint and compile without errors.
Part 3
Now rename musictester.c musictestclient.c and make the
necessary modifications in the makefile. Modify this to be a
UICI client. Now, like client.c from Part 0,
it takes two command line parameters, a host name and a port number.
After making a connection to the given host and port it uses the
single file descriptor obtained in place of the two pipes. Make sure this
lints and compiles without error.
Now test it with your musicinfoserver. You should be able to run it on the same machine or on different machines.
Part 4
Add a command '4' to musicinfoserver. When it receives this command,
it outputs the entire database to the remote machine. It does this by sending
three strings for each entry corresponding to the host name, the port number,
and the key. After sending the information it closes the network connection.
Test this using musictestclient. You will need to add a new function
to datalib that sends the information using a given file descriptor.
Part 5
Write a UICI client called musicfinder that behaves like
musictestclient, but starts by sending a command '4' to the
musicinfoserver. It gathers the information and prints the results
to the screen in tabular form with each item in the table numbered
consecutively. You may assume that the hostname and key are each
smaller that 30 characters for display purposes.
Test this with your Part 4.
Part 6
In this final part we will put musicfinder and fileget
together in a single program, musicget. It will start out like
musicfinder but then accept a number from the user corresponding to
one of the items in the table it displayed. It will then get the file
from the indicated machine (as fileget would do)
and store it in the current directory.
Here is how you will test this program using 4 machines, M1, M2, M3, and M4 and 2 port numbers p1 and p2.
Handing in your programs
Use the cover sheet to hand in the program.
If your program is working correctly, you must demonstrate it to me. Hand in your printout when it is demonstrated. The demonstrations will start on Monday, December 3 during class. If we do not finish, they may continue on December 5 after class.
If your program is not working well enough to demonstrate, you can hand in your assignment in class. Be sure to carefully fill in the description of what is working and what is not working.
Prepare your demo as follows:
Set up 5 windows on your console, like this:
------------------------------------------------ | | | Window 0 | | | ------------------------------------------------ ------------------------------------------------ | Window 1 | ------------------------------------------------ ------------------------------------------------ | | | Window 2 | | | ------------------------------------------------ ------------------------------------------------ | | | Window 3 | | | ------------------------------------------------ ------------------------------------------------ | | | Window 4 | | | ------------------------------------------------All 5 windows should be visible.
If your console is on machine M1, choose 3 other machines, M2, M3, and M4 and log into these in Windows 2, 3, and 4. Windows 0 and 1 will stay on machine M1. Choose three of your ports, p1, p2, and p3.
In Window 0, run musicinfoserver using port p1.
In Window 1, send musicinfoserver a SIGUSR1 signal.
Window 0 should show an empty database.
In Window 2, make a clean directory containing only the files
test1 and test2
copied from /usr/local/courses/cs3733/fall2001/assign6.
Run musictestclient with host M1 and port p1 to add two items to
the database.
The first item will have host M2, key test1, and port p2.
The second item will have host M2, key test2, and port p2.
Execute ls -l to show that there is nothing in this directory.
Now run fileserver in this window using port p2.
In Window 3, you will do almost the same thing as in window 2, but on machine
M3 with files test3 and test4 and port p3.
Again, run musictestclient with host M1 and port p1 to add two
items to the database.
The first item will have host M3, key test3, and port p3.
The second item will have host M3, key test4, and port p3.
Execute ls -l to show that there is nothing in this directory.
Now run fileserver in this window using port p3.
In Window 4, run from an empty directory on machine M4.
Be prepared to execute musicget in from this directory.
Wait for me to come to your console and then do the following:
Updated information on handing in your assignment, as of Dec 3, 2001.
I will not be at UTSA on Dec 3 because I have the flu. Here is what you should
do some time before 3 PM on Dec. 3.
Get everything set up as described above as if you were to demonstrate the program to me.