$29.99
CS 6378: Advanced Operating Systems
Programming Assignment 1
Requirements
1. Source code must be in the C/C++/Java programming language.
2. The program must run on UTD lab machines (dc01, dc02, ..., dc45).
3. You will need to know thread and socket programming and its APIs for the language you choose. It can be
assumed that each process (server/client) is running on a single machine (dcXY). Please get familiar with basic
UNIX commands to run your program on dcXY and UNIX/Linux system calls for directory and file operations.
Project Description
In this project, you will use a socket connection to emulate communication between two network-connected computers, say C1 and C2, and implement the following:
• C2 has a local directory D1 with two text files F1 and F2.
• C1 has no such directory.
• C2 communicates with C1 to make a copy of D1 and all its contents at C1. As a consequence, now there are
two replicas of directory D1 on different machines.
As you do not have access to two different file systems, you will achieve the desired outcome as follows:
1. First create a subdirectory named D1 in your UTD home directory.
2. Establish a VPN connection with UTD, and then log into two of the dcXY machines mentioned above. One of
them will act as C1 and another as C2. Ideally, you would have two separate terminal windows, one in which
you are logged into C1 and another in which you are logged into C2. You should have access to your UTD home
directory on these machines.
3. Launch a socket server program that you will write as part of this project on C1. Now, C1 will be listening for
incoming connection requests.
4. Next, launch the socket client program, also written by you as part of this project, on C2.
5. Have the client running on C2 establish a reliable socket connection (TCP) with the server running on C1.
6. Once the connection is established, have C2 send a message to C1 to create a directory D1copy.
7. On receiving the request from C2, the server running on C1 should create a subdirectory D1copy in the home
directory and send an acknowledgment to C2.
8. Next C2 should send a message to C1 to create the first file named F1.
9. C1 must create a file named F1 in subdirectory D1copy and acknowledge the successful creation of the file.
10. C2 should read and send contents of file F1 to C2 in successive messages of size 256 bytes (or remaining size
of the file when you get near the end of the file).
11. C1 should append the file contents received from C2 into file F1 in subdirectory D1copy.
12. When all contents of file F1 have been successfully sent by C2 and copied by C1, C2 should send a message indicating end of file, and C1 should respond with a message indicating successful creation of the file in
subdirectory D1copy.
13. Repeat the steps described above to also copy file F2 from subdirectory D1 to D1copy.
14. Have C2 send a message indicating end of session to C1, close the socket connection and terminate.
15. Have C1 also close the connection and terminate on receiving the end of session message from C2.
When your processes terminate at both the machines, you should have two subdirectories in your UTD home directory,
names D1 and D1copy with identical contents.
Submission Information
The submission should be through eLearning in the form of an archive consisting of:
1. File(s) containing the source code.
2. The makefile used for compilation purposes.
3. The directories and files you used to test the execution of your code.
Please do “make clean” before submitting the contents of your directory. This will remove the executable and
object code that is not needed for submission.
Your source code must have the following, otherwise you will lose points:
1. Proper comments indicating what is being done
2. Error checking for all function and system calls
2