handle socket.error