Sockets Programming Assignment 1 -
Assigned: January 29
Due: Sunday February 11 11:59 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 loan ammortization schedule calculator. You will read in an interest rate, loan amount and duration and print the resulting payment schedule. The client will not do any calculation but will instead send a request to the server to be calculated.
You can limit the application to support only durations of years
and monthly payments.
You should support both integer and floating point values.
You must allow the IP address of the server to be specified
on the command line of the client.
For instance, the command:
loan 127.0.0.1 5.6 125,000 2
indicates a 125,000 dollar loan at 5.6 percent interest for 2 years.
It should produce output something like the following:
Amortization Schedule
Month Interest Principal Balance
Jan, 2007 $572.92 $4,939.04 $120,060.96
Feb, 2007 $550.28 $4,961.68 $115,099.28
Mar, 2007 $527.54 $4,984.42 $110,114.86
Apr, 2007 $504.69 $5,007.26 $105,107.60
May, 2007 $481.74 $5,030.21 $100,077.39
Jun, 2007 $458.69 $5,053.27 $95,024.12
Jul, 2007 $435.53 $5,076.43 $89,947.69
Aug, 2007 $412.26 $5,099.70 $84,847.99
Sep, 2007 $388.89 $5,123.07 $79,724.92
Oct, 2007 $365.41 $5,146.55 $74,578.37
Nov, 2007 $341.82 $5,170.14 $69,408.23
Dec, 2007 $318.12 $5,193.84 $64,214.39
Jan, 2008 $294.32 $5,217.64 $58,996.75
Feb, 2008 $270.40 $5,241.56 $53,755.20
Mar, 2008 $246.38 $5,265.58 $48,489.62
Apr, 2008 $222.24 $5,289.71 $43,199.90
May, 2008 $198.00 $5,313.96 $37,885.95
Jun, 2008 $173.64 $5,338.31 $32,547.63
Jul, 2008 $149.18 $5,362.78 $27,184.85
Aug, 2008 $124.60 $5,387.36 $21,797.49
Sep, 2008 $99.91 $5,412.05 $16,385.44
Oct, 2008 $75.10 $5,436.86 $10,948.59
Nov, 2008 $50.18 $5,461.78 $5,486.81
Dec, 2008 $25.15 $5,486.81 $0.00
This query would have been sent to the server application running on the local host (same system). The only output is the resulting table or an error message if it fails. Note: The command line must work exactly this way to make sure the TA can easily test your program.
You will need to develop your own "protocol" for the communication between the client and the server. While you should use TCP or 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.
Your server application should listen for requests from loan clients, process the client and return the result. After handling a client 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.
Focus on limited functionality that is fully implemented. Practice defensive programming as you parse the data arriving from the other end. Do not work on a fancy GUI, but focus on the protocol and data exchange. Make sure that you deal gracefully with whatever you or the TAs might throw at it.
You are welcome (encouraged even) to use external sources as you develop the ammortization algorithm. However, you must include a citation (text or web site) in your source code and project description if you use an external reference.
Notes:
Turnin Instructions:
You will be graded on the correctness of the code and its readability and structure. Your code and supporting documentation will account for one-third of your homework grade. (The remaining two-thirds will be split one-third for the TCP program and one-third for the UDP program.) 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.