Assignment 11 cs494-unp Revised 10/27/99 Assigned: October 26, 1999 Due: December 10, 1999 6:00pm Objective: reliable UDP, library Points: 60 Description: Develop a UDP server and client library that implements a simple remote file system. The following file operations should be supported: int ncreat(char *server, char *path, int mode) int nopen(char *server, char *path, int flags) flags: O_RDONLY O_WRONLY O_RDWR int nread(int nfd, char *buff, int bytes) int nwrite(int nfd, char *buff, int bytes) int nlseek(int nfd, int offset, int whence) int nclose(int nfd) int nunlink(char *server, char *path) Some of these functions can be implemented within the client library. You may assume that the nread/nwrite byte count will always be 1024 or less, and that the path name length will be less than 64 bytes. Your client library should support up to 10 file descriptors. The functions should also return the UNIX errno from the server and set the errno on the client if the server has detected an error. If "nfd" is not a valid file descriptor, your library should set errno to EBADF and return -1. Your library should use a fixed 5 second timeout with up to 3 retries. (Your library can print a message and exit if no response from server after three tries.) Use make and ar/ranlib to make the client library (libclient.a) Your server should be stateless and all files created/used by the server should be in a subdirectory, that is, always run your server in a subdirectory where you can't damage your other files. Don't allow a client to trick you into writing out of that directory. (Your server should check for filenames beginning with / or . and return an EFAULT error.) You can assume your client/server will be run on a homogeneous set of machines -- don't worry about byte order. But you should make note of that assumption in the program comments. 1) Test your server and library with ~dunigan/cs494-unp/client.c where the client and server are running on different machines. Save the client output in client.out 2) Discuss how you might test your client's retransmission code. 3) Develop a network file copy program (ncp) that uses your client library and your server and copies a local/remote file to a local/remote file. Command arguments must end in a file name (no . or directory). Command syntax for ncp is ncp [hostname:]fromfile [hostname:]tofile If no hostname is specified, it looks for your server on localhost. For example, ncp local.file other.file ncp local.file cetus1a:test1 ncp cetus1b:test1 cetus1a:test3 Test the above combinations and provide test evidence in test.out Test with binary and ascii files, and check with "diff". Test with files greater than 1024 bytes. Be sure to include tests of various illegal combinations in test.out Don't forget to kill your server when you're done. Optional: please indicate amount of time required to complete assignment. Use ~dunigan/cs494-unp/494submit to submit your source files and output. See http://www.cs.utk.edu/~dunigan/cs494-unp/policy.txt