Clean shutdown on SIGINT signal,

and print SocketExceptions instead of crashing
Implemented argument parsing