cleanup from moving sock stuff into struct
implement getopt