Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

Sample run of TimeServerHW (with clients connecting)
Server client 1 client 2
~/$ java TimeServerHW 25001
~/$ nc localhost 25001
legal formats are: mm/dd/yy, mm/dd/yyyy, yyyy/mm/dd.
~/$ nc localhost 25001
2015/04/20 15:52:02

  1. [70Pts] Your HW is to add proper error handling to this program. You should do it to the greatest extent possible via try-catch exception handling. The following should all result in the erver exiting with the given error message:
    ~/$ java TimeServerHWSol
    usage: java TimeServerHW <portnum>
    ~/$ java TimeServerHWSol foo
    Error! argument 'foo' not a number!
    ~/$ java TimeServerHWSol 9999999
    Error! Bad port number '9999999'!
    ~/$ java TimeServerHWSol 23
    Error! Failed to bind server socket to port 23!
    Note: The ServerSocket constructor throws an IllegalArgumentException if the int argument is an invalid port number (e.g. negative), and a BindException if it is a valid port number, but one that OS policy prevents you from using or one that is already in use by another process (e.g. 23 in the above example).

    If a connected client ctrl-c's before the transaction with the server is complete (or any other error involving a connected client's request), the error message shown below should be printed and that connection closed, but the server should not exit - it should still be accepting and processing requests.

    ~/$ java TimeServerHWSol 25001
    Error! Something went wrong with connection Socket[addr=/,port=37259,localport=25001]  client ctrl-c'd
    Any other error should result int he message Server failure! being printed and the server exiting.

    Turn In along with this sheet, a codeprint printout of your code, along with a screen capture showing the error messages depicted above being printed out.

  2. [30Pts] Consider the following three hypothetical DDOS clients:

    Hopefully you understand how they work! Compare and contrast, explaining which is besta and why, and which is worst and why!