본문 바로가기
Java, JavaScript

java.net.SocketTimeoutException: connect timed out

by swconsulting swconsulting 2018. 7. 12.



I've searched all over the web and after reading lot of docs regarding connection timeout exception, the thing i understood is that, preventing SocketTimeoutException is beyond our limit...One way to effectively handle it is to define a connection timeout and later handle it by using a try catch block.... hope this will help anyone in future who are facing the same issue.

HttpUrlConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(7000); //set the timeout in milliseconds




source : https://stackoverflow.com/questions/15608499/getting-java-net-sockettimeoutexception-connection-timed-out-in-android

댓글1