CSCI 1730 Programming Project 5B Summer 2009 UDP Server This program is due by midnight on *** Wednesday, July 15. *** The goal of part B of Project 5 is to finish the introduction to socket programming by implementing a UDP server to work with your UDP client from part A. Your server will start up on a port number specified on the command line, and report its activities to the screen or to a new log file named in an optional second command line parameter. Your executable file should be named UDPServer. It should run from the command line with one or two arguments, which we'll call "port_no," and "logfile", in that order. Log messages from the server are to be written to STDOUT if the "logfile" argument is omitted. Otherwise a new file "logfile" should be opened in the current working directory and all log messages written to it. Include a line return at the end of each log message. When the server is started up initially it should log the message: "UDPServer running on server host IP i.j.k.l, that is w.x.y.z, at port u." Here "i.j.k.l" is the IP address of the host, for instance "128.192.251.5" if the host is "odin," and "w.x.y.z" is the IP name of the host, e.g., "odin.cs.uga.edu" for "odin." At the end, "u" should simply be "port_no". The original server process should run indefinitely. Whenever a client sends a UDP message to the server's host at port number port_no, the server should recieve it and log the message: Connection made from client host IP i.j.k.l, sending from port u. Here "i.j.k.l" is the dotted quad IP address of the client's host machine, and "u" should be the port number the client sent from. The message from the client is to be treated as a single string, say c_mssg for purposes of discussion. The next log message should be Received: c_mssg Next, the server should send a message to the client in the format Hey, got your message. It was: c_mssg'$ Here c_mssg' is the same as c_mssg except that each '_' character is replaced by ' ' (the space character). The '$' character is appended at the end, to indicate the end of the message to the client. Your project submission should include an implementation file UDPServer.c, a Makefile and a READ_ME file. You may include other files for your implementation, but in any case your Makefile should compile UDPServer.c and any auxiliary files to UDPServer using gcc upon the single command "make". Some things to note: *The names of the files submitted and of the executable files generated by the Makefile must be followed exactly, so that the teaching assistant and the instructor can test your project without editing your code. *Your code should perform correctly for servers on different machines. Your code should do this from "atlas", "odin", or any of the Linux workstations in the 307 lab. *As long as you give due credit to the authors, in your READ_ME file and as comments in each relevent source code file, it is okay to modify or build on code supplied on their web site by Michael J. Donahoo and Kenneth L. Calvert (first link under "Sockets and UNIX IPC references" on the course "resources" sub-page.) *On some systems, including "atlas", the gcc compiler needs special instructions to search for the libraries which support sockets. A typical compile command on "atlas" would be gcc UDPServer.c ErrorExit.o -o UDPServer -lsocket -lnsl *Your programs must be written in C. *The program should be robust and include appropriate error checks. For instance, if a second command line argument "logfile" already exists then an error message should be issued; if it does exist already, it should not be removed or altered. Any sequence of command line parameters which does not conform to a meaningful pattern should result in an error message followed at once by termination. That could be too many, too few, or first parameter which does not represent a positive integer in standard (sign-free) decimal notation. *Your project will be tested on Linux and SunOS. So your project must compile on "albany" or any of the other Linux workstations in the 307 lab using gcc for GCC 4.1.2, and also on "atlas" using gcc for GCC 3.3.2. Projects which compile properly will be scored out of 100 (if on time) based on (1) correctness of operation, (2) quality of design, (3) coding style and documentation of the source code, and (4) correctness and usefulness of the READ_ME file and the Makefile.