tcp socket: handle socket.error