setup the socket connection for two devices