new: an helper function to find out which ends of a socket is the server