This assignment is a continuation of Assignments 4 and 5. In this assignment you will be doing the compiles on different machines and using the network for communication.
Part 1
Write a parallel server, compileserver, that takes a single command
line parameter, a port number. It will listen on the port, and when a
connection occurs, a line will be read from the network. The line (without
the newline) will represent the path of a C source program to compile.
The child will peel off the directory and make that the current
working directory (use chdir(2)).
It will then call compile with the file name (without the
directory) as a parameter. As before, get the path of the C compiler
from makelib.h. If successful, a single byte containing the
byte '0' will be sent back to the client. Otherwise a single
'1' will be sent back.
You can test your server using the client2 program to send a line to your server. It will show you the output sent back because it is a printing character.
Part 2
Write a main program called networkcompile which will take
an odd number of command line parameters. The first parameter will
be a port number. Each pair of remaining parameters will be a host name
and a C source file name (without the extension, as in previous assignments).
For each pair of parameters, it will make a connection to the host and send
the full path of the file to the remote host as a single line.
Get the path from the current directory (use getcwd(3C))
and be sure to include the path separator, '/', if necessary.
Get the return value from the remote
compiler (in the format from Part 1). If all of the individual
compiles were successful, make an executable, as before.
Do the above in such a way that all of the compiles can be done in parallel. You cannot implement it as follows:
Handing in your assignment
Test your programs as in Assignment 5.
The servers should not have to be running from the directory that contains the
files to compile.
Use this cover sheet.