android - java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) is occures when using mobile data -
i have android application use http request communicate through server blow lines.
httpparams httpparams = new basichttpparams(); httpconnectionparams.setsotimeout(httpparams, time_out); httpclient httpclient = new defaulthttpclient(httpparams); ((abstracthttpclient) httpclient).sethttprequestretryhandler(new defaulthttprequestretryhandler(num_retries, true)); try { stringentity se = null; try { se = new stringentity(params.tostring(), "utf-8"); se.setcontenttype("application/json; charset=utf-8"); } catch (unsupportedencodingexception e) { e.printstacktrace(); } httppost httppost = new httppost(uri); httppost.setentity(se); httpresponse response = httpclient.execute(httppost); httpentity resentity = response.getentity(); }
when use wifi send http request fine , i'll response. when using cellular mobile data break in line httpresponse response = httpclient.execute(httppost);
, gives following error:
java.net.socketexception: recvfrom failed: econnreset (connection reset peer)
Comments
Post a Comment