Main that initializes a socket at the beginning