[英]Android - client causing “Connection reset by peer” exception
I would like to know, whether there is a possibility that the implementation of the client side, could be causing this IOException? 我想知道,客户端的实现是否有可能导致此IOException? As far as I know, this exception is caused by the remote site, sending the RST packet, effectively shutting down the connection.
据我所知,此异常是由远程站点发送RST数据包引起的,实际上是关闭了连接。 Whatever answers I have come up with so far, all claim that this is the server's fault.
到目前为止,无论我提出什么答案,都声称这是服务器的错误。
But the problem is the following. 但是问题是以下。 I am communicating with the server via TCP sockets and the android app is the client.
我正在通过TCP套接字与服务器通信,而android app是客户端。 The communication used to work prefectly, but after making some modifications (to the client side ONLY), I keep getting this exception.
通讯过去可以很好地工作,但是在进行了一些修改(仅限客户端)之后,我不断收到此异常。
I am having a hard time pinpointing the source of the problem, because the updates I've made had nothing to do with the communication implementation. 我很难确定问题的根源,因为我所做的更新与通信实现无关。 I've only added another query for the server to handle.
我只为服务器处理添加了另一个查询。
Is it possible to produce this exception from the client side(that my code, could cause the remote side to produce this outcome)? 是否有可能从客户端生成此异常(我的代码可能导致远程生成此结果)? Perhaps by overloading the server with requests?
也许通过服务器超载请求? Or maybe Android is closing my sockets, by itself?
还是Android本身正在关闭我的套接字? Or perhaps I am somehow closing the sockets, but that would probably produce a different type of exception.
或者,也许我以某种方式关闭了套接字,但这可能会产生不同类型的异常。
Any advice on the matter would be very much appreciated. 对此事的任何建议将不胜感激。
As it turns out, the problem wasn't in the client implementation afterall. 事实证明,问题根本不在客户端实现中。 The server was actually ending the connection, after a certain query had been executed.
执行某些查询后,服务器实际上正在终止连接。 To anyone who may be experiencing a similar issue (where you think the client side has an error, despite the obvious fact stated by the program, that it's the server's fault), I suggest you double check the server for possible timeouts and such.
对于可能遇到类似问题的人(尽管程序指出了明显的事实,但您认为客户端有错误,这是服务器的错误),我建议您仔细检查服务器是否存在超时等问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.