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 yyyy/mm/dd 2015/04/20 15:52:02
~/$ 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=/127.0.0.1,port=37259,localport=25001] ← client ctrl-c'dAny 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.