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
Post a Comment