ErrnoException:改变使用ICS WiFi网络时EHOSTUNREACH(没有到主机的路由):isConnected失败 [英] ErrnoException: isConnected failed: EHOSTUNREACH (No route to host) when changing the wifi network using ICS

查看:4154
本文介绍了ErrnoException:改变使用ICS WiFi网络时EHOSTUNREACH(没有到主机的路由):isConnected失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用我的IC上的应用程序后,我改变我从networkA WIFI网络,以网络B的图像的所有请求开始回来有例外。

When using my app on ics, after I change my wifi network from networkA to networkB all the requests for images start coming back with an exception.

失败,除了

> org.apache.http.conn.HttpHostConnectException: Connection to
> https://m1.testapp.com refused    at
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
>   at
> org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
>   at
> org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
>   at
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
>   at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
>   at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
>   at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
>   at
> com.testApp.android.ws.PooledRequestProcessor$Runner.run(PooledRequestProcessor.java:298)
>   at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
>   at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
>   at java.lang.Thread.run(Thread.java:856)  Caused by:
> java.net.ConnectException: failed to connect to /109.233.153.38 (port
> 443) after 20000ms: isConnected failed: EHOSTUNREACH (No route to
> host)     at
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:181)
>   ... 10 more  Caused by: java.net.SocketException: failed to connect
> to /109.233.153.38 (port 443) after 20000ms: isConnected failed:
> EHOSTUNREACH (No route to host)   at
> libcore.io.IoBridge.isConnected(IoBridge.java:220)    at
> libcore.io.IoBridge.connectErrno(IoBridge.java:152)   at
> libcore.io.IoBridge.connect(IoBridge.java:112)    at
> java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)    at
> java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)    at
> java.net.Socket.connect(Socket.java:842)      at
> org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
>   at
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
>   ... 10 more  Caused by: libcore.io.ErrnoException: isConnected
> failed: EHOSTUNREACH (No route to host)   at
> libcore.io.IoBridge.isConnected(IoBridge.java:201)

最奇怪的是,即使卸载应用程序,并重新安装它不会修复它,只需打开手机,然后对。

The strangest thing is that even uninstalling the app and reinstalling it wont fix it, just turning the phone off and on.

我看到一个类似的问题在这里<一href="http://groups.google.com/group/newsrob/browse_thread/thread/ea2f26d9d1753b79/5800e268eeab399c#5800e268eeab399c" rel="nofollow">http://groups.google.com/group/newsrob/browse_thread/thread/ea2f26d9d1753b79/5800e268eeab399c#5800e268eeab399c 。该问题不会发生在手机上使用4.0.3,只是对那些与4.0.1,并且似乎没有更新是在欧洲呢。

I saw a similar problem here http://groups.google.com/group/newsrob/browse_thread/thread/ea2f26d9d1753b79/5800e268eeab399c#5800e268eeab399c . The problem is not happening on phones with 4.0.3, just on the ones with 4.0.1, and the update doesnt seem to be available in Europe yet.

推荐答案

也许这是采取一段时间的切换要发生的某些原因?您可以检查,看看是否有发出请求之前,活动的网络连接:

Maybe it's taking a while for the switch over to take place for some reason? You can check to see if there is an active network connection before making the request:

ConnectivityManager connectivityManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo                 = connectivityManager.getActiveNetworkInfo();

if (networkInfo != null && networkInfo.isConnected() && networkInfo.isAvailable())
{
    // DO WHAT YOU NEED TO DO ON THE NETWORK
}
else
{
    // PROMPT USER THAT NETWORK IS DISCONNECTED

        Toast.makeText(this, "There is no active network connection!", 5000).show();
}

这篇关于ErrnoException:改变使用ICS WiFi网络时EHOSTUNREACH(没有到主机的路由):isConnected失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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