# uft -- UDP file transfer Write a small application program started from the command line (and controlled via options given on the command line) that transfers a specified flie from a sender to a receiver and ensures that the file contents will either arrive intact or that an error message is given. The program shall support two server modes of operation... uft -a: run in server mode and accept incoming files from any host. uft -s: run in server mode and accept requests for the transmission of a file from any host. ...as well as the following client modes: uft -t: run in client mode and transmit a file specified on the command line to a specified target host. uft -r: run in client mode and request a server to transmit a specified file to a specified target host. The comand line option -p shall be used to specify the UDP port number to use. If -p is not provided, your program should use a default chosen by you. The command line option -l is used to "simulate" random packet losses, i.e., create artificial losses when sending. -l takes arguments in the range [0.0, 1.0]. If -l is not specified, a loss of 0.0 is assumed. The packet loss is applied to *all* packets to be transmitted, e.g. data packets on the sender and possible acknowledgements on the receiver sise but also other control packets you may decide to use. The command line option -b shall be used to specify the bit rate at which the file transfer shall take place (to be specified in bit/s _gross_ transmission rate, i.e. include expected IP, UDP, and application layer header overhead). If a file requested is not available, an error shall be reported (locally for a client as well as remotely via the network from a server). The precise command line syntax is given below: uft [-a|-s] [-p port] [-l lossrate] uft host [-p port] [-l lossrate] -b bitrate [-t|-r] filename Define your own small protocol to achieve this and remember that you need to communicate at least: * the filename * the file size (or some other way to know that the file is complete) * error checking information, e.g. possibly a checksum for the file Transmission of file data shall take place in blocks of 1024 bytes of file data per UDP packet (i.e., not including protocol overhead). You are free in your protocol encoding (text, binary, etc.) and the choice of the method(s) to achieve reliability -- for both the requests and the transmissions. You should document your protocol design including header syntax and interactions and discuss why you have chosen this particular design. Note that the next assignment will build upon your present protocol and may add yet unknown (even to the organizers of the course) requirements. So, try to keep your protocol focused and flexible.