extract the common recv logic in its function, so we dont have to duplicate the count/error handling for both udp and tcp
add snd/rcv buf sockopts support in open_socket(); create the listening sockets with 16mb buffer by default