CS 3733 Operating Systems, Fall 2007 Recitation Sessions 10 and 11
Week of November 5 and Noverber 12
In this session you will prepare for Assignment 6.
You must be familiar with Recitation 9 and bring a copy of your programs
from Assignment 4 to run.
- Create a Rec10 directory.
- Copy your Assignment 4 code into this directory.
- Make an additional copy your main program from Assignment 4.
Call it solution_maker.c. Modify your makefile so
that it also compiles solution_maker.
- Also copy all of the following files from your Recitation 9 into this
directory:
- client.c
- uici.c
- uiciname.c
- restart.c
- uici.h
- uiciname.h
- restart.h
You can also find these files
here.
- Modify solution_maker so that it takes
two command line parameters, a host name and a port number,
just like client.c.
- Write a new method in solution_maker.c called
send_to_solution_server. This takes an item parameter
and two additional parameters that came from the command line. These
command-line parameters will be ignored for now.
For now, this method will just print the item on a single line.
Replace the code that puts the solution in the solution_buffer
with a call to send_to_solution_server. Remove any references
to the solution_buffer in your solution_maker.
Also remove it from the compile line for solution_maker in the
makefile. If you put additional code in solution_buffer
for your Assignment 4, you may need to put it elsewhere.
- Run you program for N=5 and a large enough number of iterations to produce
several lines of output. Note that there should be duplicates in this
output.
- Now modify send_to_solution_server so that it makes a connection
to the host and port and sends the item to the remote host
one value at a time. Before sending, convert each value to the
data type uint16_t in network byte order. Some of the extra code
will be similar to client.c. You might also need to include
arpa/inet.h in your source. Modify the makefile
appropriately. You will need to link to the following code:
- uici.c
- uiciname.c
- restart.c
and you will need the following libraries:
-lpthread -lrt -lnsl
- Test your program with the server that your instructor will start running.
- Be sure to sign in before leaving the lab.