Handle tcp_error

Handle tcp_error so that the client won't crash and will attempt reconnect