在HTTP调用Android的随机例外。为什么? [英] Android random exceptions on HTTP calls. Why?

查看:159
本文介绍了在HTTP调用Android的随机例外。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我3设备上测试我的应用程序为止。一个设备LG擎天柱来自Sprint从来没有(在一个星期内,也许一次)抛出的HTTPS调用例外

I'm testing my app on 3 devices so far. One device LG Optimus from Sprint never throws exceptions on https calls (maybe once in a week)

这是T-Mobile的歌Nexus S几乎每隔一小时拿出这样的:

Nexus S on T-Mobile almost every hour come up with something like this:

读取错误:SSL = 0x3f4060:I / O错误
  系统调用过程中,连接复位
  通过对

Read error: ssl=0x3f4060: I/O error during system call, Connection reset by peer

现在我得到的测试片(S7纤薄),它是通过WiFi连接,我得到这样的错误:

Now I got tablet for testing (S7 slim) and it's connected via WiFi and I get errors like:

SSL关机失败:在I / O错误
  系统调用,破碎管

SSL shutdown failed: I/O error during system call, Broken pipe

做的,你知道为什么这些发生的事情是有什么办法避免呢?

Do you know why those happen and is there any way to avoid them?

推荐答案

剩下的由同行表示服务器拒绝/失去连接。在SSL失败可能是连接复位的一个直接结果。我敢打赌,这在一些长期连接的中间交换网络时(WIFI到3G)发生。

Rest by peer means the server is rejecting/losing your connection. The SSL failure is probably a direct result of the connection reset. My bet is that this happen when switching networks (wifi to 3G) in the middle of some long standing connection.

如果有可能创建一个连接,做任何IO,并尽快断开连接。如果你需要处理长期持久连接是ppared来处理这些异常,并重新连接幕后$ P $。

If possible create a connection, do any IO, and disconnect as quickly as possible. If you do need to handle long persistent connection be prepared to handle such exceptions and reconnect behind the scenes.

这篇关于在HTTP调用Android的随机例外。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆