Socket timeout exception with connection on Android -
i have code test connection https url:
ctimertask = new timer(); ctimertask.scheduleatfixedrate(new timertask() { public void run() { try { url myurl = new url("https://www.google.it"); httpsurlconnection connection = (httpsurlconnection) myurl.openconnection(); connection.setconnecttimeout(15000); connection.connect(); log.d(tag, "!!! responsecode: " + connection.getresponsecode()); //log.d(tag, "connection ok"); } catch (malformedurlexception e) { log.d(tag, "!!! malformed url"); e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } }, globalclass.delay_connection_check, globalclass.period_connection_check); sometimes (not always) wrong , have sockettimeoutexception, have no problem connection, internet working well. have used code long time, in last week have problem.
w/system.err: java.net.sockettimeoutexception: failed connect www.google.it/216.58.210.195 (port 443) after 15000ms w/system.err: @ java.net.plainsocketimpl.connect(plainsocketimpl.java:183) w/system.err: @ java.net.plainsocketimpl.connect(plainsocketimpl.java:456) w/system.err: @ java.net.socket.connect(socket.java:882) w/system.err: @ com.android.okhttp.internal.platform.connectsocket(platform.java:174) can me please?
can directly ping ip , check if receiving response!!
Comments
Post a Comment