HTTP setReadTimeOut may work if the network is unavailable after sending data to the server and waiting for a response from the server

I sent data from Android Mobile to the server via an HTTP connection. I was able to send POST data to the server, as well as receive confirmation from the server. But someday, if my communication flow with the server is waiting for confirmation from the server after publishing the data, that time I will lose the Internet connection and the thread cannot receive Ack from the server and goes in an endless loop. I tried the setReadTimeOut (180000) method.

Could this work for me? Can it throw a SocketTimeOutException if there is no network Available / No connection between the server and the mobile device.

+3
source share
1 answer

, , . 180000 (= 180 = 3 !). 30 . setConnectTimeout

, , HttpUrlConnection :

  • Android 2.2 HTTP- Apache (. )
  • (. )
+2

All Articles