Added signal checking to properly close sockets on Ctrl+C. Port is now to be passed as the first argument.