4

在我的应用程序中,我正在下载加载数据。一切都很好,但有些它给出了奇怪的响应并抛出了 socketException:connectiontimout?

请问谁能告诉我这些异常的原因是什么?这样我就可以找出问题了吗?

给我一些解决方案来避免这些异常

这里日志去......

**

04-19 15:44:52.591: WARN/System.err(18199): java.net.SocketException: Connection timed out
04-19 15:44:52.591: WARN/Smack/Packet(209): notify conn break (IOEx), close connection
04-19 15:44:52.591: DEBUG/Smack(209): [XMPPConn] close connection, notifyClosed=false
04-19 15:44:52.591: WARN/System.err(18199):     at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method)
04-19 15:44:52.591: WARN/System.err(18199):     at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273)
04-19 15:44:52.591: WARN/System.err(18199):     at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458)
04-19 15:44:52.591: WARN/System.err(18199):     at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85)
04-19 15:44:52.591: WARN/System.err(18199):     at java.io.BufferedInputStream.read(BufferedInputStream.java:319)
04-19 15:44:52.591: WARN/System.err(18199):     at org.apache.harmony.luni.internal.net.www.protocol.http.FixedLengthInputStream.read(FixedLengthInputStream.java:44)
04-19 15:44:52.591: WARN/System.err(18199):     at java.io.BufferedInputStream.read(BufferedInputStream.java:319)
04-19 15:44:52.591: WARN/System.err(18199):     at java.io.FilterInputStream.read(FilterInputStream.java:133)
04-19 15:44:52.591: WARN/System.err(18199):     at com.logictreeit.pilot.utils.Download.Download1(Download.java:245)
04-19 15:44:52.591: WARN/System.err(18199):     at com.logictreeit.pilot.utils.Download.access$4(Download.java:225)
04-19 15:44:52.591: WARN/System.err(18199):     at com.logictreeit.pilot.utils.Download$DownloadTask.doInBackground(Download.java:171)
04-19 15:44:52.591: WARN/System.err(18199):     at com.logictreeit.pilot.utils.Download$DownloadTask.doInBackground(Download.java:1)
04-19 15:44:52.591: WARN/System.err(18199):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-19 15:44:52.591: WARN/System.err(18199):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
04-19 15:44:52.591: WARN/System.err(18199):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
04-19 15:44:52.591: WARN/System.err(18199):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
04-19 15:44:52.591: WARN/System.err(18199):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
04-19 15:44:52.591: WARN/System.err(18199):     at java.lang.Thread.run(Thread.java:1019)

**

问候, 斯里尼瓦斯

4

2 回答 2

3

“连接超时”是网络环境中的预期行为。在网络连接可能不可靠的移动环境中,这更令人期待。这意味着服务器在一定秒数内未能响应。

因为这是正常行为,您需要在您的 android 应用程序中处理它。尝试重试,向您的用户显示错误消息,或执行其他适当的操作。

于 2011-04-19T13:45:21.087 回答
0

AIX:IBM Java:java.net.SocketException:连接超时:可能是由于地址无效 android 也是如此

于 2011-04-19T13:08:36.600 回答