CS 6250 - Computer Networks

Sockets Programming Assignment 1
Assigned: September 1
Due: Wednesday September 14 23:55 PM


TCP and UDP Applications Programming

For this assignment you will design and write your own application program using network sockets. You will implement two different versions of the application. One version will be based on TCP. The other will use UDP. You will write both the client and server portions of this application.

The application you are designing is a currency exchange calculator. The client interface will allow users to perform simple currency conversions. The client command should be called Exchange and should support conversions between at least the following forms of currency.

  • CAD - Canadian Dollars

  • EUR - Euro

  • INR - India Rupees

  • JPY - Japanese Yen

  • USD - US Dollars

    For each valid invocation, the resulting equivalent currency value(s) should be printed for the user. You will support conversion from one currency to one or more target currencies.

    You must allow either the hostname or IP address of the server to be specified on the command line of the client. For instance, the command:

    Exchange myserver.mynet.com 10.25 CAD EUR INR

    would convert from Canadian dollars to Euros and Rupees and might produce the output:

    10.25 CAD
    6.47 EUR
    363.45 INR

    This query would have been sent to the server myserver.mynet.com. Note that if you want to query a server application running on the same computer as the client you can always use the loopback address, 127.0.0.1.

    The only output of the program should be the numeric output with units or an error message if it fails.

    When you build this application you are to assume that the client program is not capable of doing the math itself. Instead, the client must request the result from the server.

    You will need to support fractional units down to the 100's place (e.g. dollars and cents). I strongly suggest that you consider designing your program and application protocol such that the internal representation is in hundredths. This eliminates the need to deal with floating point in your transfer protocol. Make sure that you do sufficient error handling such that a user can't crash your server. For instance, what will you do if a user provides invalid input? What about a negative value? What about a number larger than 4 billion? (It could be Bill Gates trying to buy a country afterall.)

    Your server application should listen for requests from Exchange clients, process the requested operation(s) and return the result. After responding to a request the server should then listen for more requests. The server application should be designed so that it will never exit as a result of a client user action.

    You can use hardcoded currency exchange rates in your server. For today's exchange rates, do some lookups on one of the many Internet services such as http://www.xe.com/ucc/ .

    Notes:

    1. You are implementing two complete, separate versions. A client and server using TCP and another client and server using UDP. Your final submission should include 4 separate executables programs.
    2. Your programs are to be written in standard Java and should run on the Linux systems provided by GTL. You should find Java to be portable enough that you can do your actual development on most any platform.

    3. Be careful not to use any libraries that are not standard and not available on the GTL systems as I will use these to test your programs. A portion of your grade will come from me running your program.

    4. You should select a port for your Exchange service. I recommend something between say 13000 and 14000. You will need to make sure nobody else in the class is running their server on the same system using the same port as you. (Consider using the value 13000 + your birthday ). Make sure you kill your server when you are done working. See the netstat command for checking on busy network ports.

    5. You will need to develop your own "protocol" for the communication between the client and the server. While you should use TCP and UDP to transfer messages back and forth, you must determine exactly what messages will be sent, what they mean and when they will be sent (syntax, semantics and timing). Be sure to document your protocol completely in the program writeup.

    6. Your design should be flexible without arbitrary constraints. For instance, your protocol should not limit the number of requests made to the server.

    7. You must test your program and convince me it works! Provide me with a sample output (you can use script or cut-and-paste) that shows all of your functions working. If you fail to demonstrate a capability of the program I will assume that feature does not work.

    Turnin Instructions:

    1. You will turn in your well-documented source code, a README file and sample output file called Output.txt. The README file must contain:
      1. Your Name and email address
      2. Class name, date and assignment title
      3. Names and descriptions of all files submitted
      4. Detailed instructions for compiling and running your client and server programs.
      5. A description of your application protocol (1/2 to 1 page) with sufficient detail such that somebody else could implement your protocol.
      6. Any known bugs or limitations of your design or program.

      You will be graded on the correctness of the code and its readability and structure. Your source code and supporting documentation will account for one-half of your homework grade. The other half of the grade comes from the execution testing itself. As you write the documentation, imagine that I intend to implement your protocol in my own client that will interoperate with your server. Make sure I don't have to read your source code to figure out how to do this.

    2. By 23:55 on the due date, you must submit your program files online.
      1. Use the UNIX "tar" command to create an archive of your complete set of files, naming your .tar archive file "p1_lastname_firstname.tar": (e.g. tar cvf p1_burdell_george.tar
        Email the resulting tar file as an attachment to me at rjc@cc.gatech.edu using the subject line CS6250 Program 1.