port commandline parsing code, sockets