Better error handling for unable to connect to socket.