java android java.net.SocketTimeoutException -


sometimes here have java.net.sockettimeoutexception

   while ((bytesread = inputstream.read(content)) != -1) {                             baos.write(content, 0, bytesread);                             str = baos.tostring("utf-8");                             system.out.println(str);                             requestsocket.setsotimeout(8000);                             break;                         } 

in line :

 while ((bytesread = inputstream.read(content)) != -1) 

you getting read timeout because set 8-second read timeout , peer took more 8 seconds send data. if don't want that, increase read timeout. if want it, fix peer.

your code doesn't make sense. setting read timeout inside loop, pointless, , you're breaking after single read, ditto.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -