connects the socket only once