java.net.SocketException:recvfrom失败:使用移动数据时发生EconReset(由对等方重置连接)
我有一个android应用程序,它使用http请求通过服务器与blow lines进行通信java.net.SocketException:recvfrom失败:使用移动数据时发生EconReset(由对等方重置连接),java,android,httprequest,apache-httpclient-4.x,cellular-network,Java,Android,Httprequest,Apache Httpclient 4.x,Cellular Network,我有一个android应用程序,它使用http请求通过服务器与blow lines进行通信 HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setSoTimeout(httpParams, time_out); HttpClient httpclient = new DefaultHttpClient(httpParams); ((AbstractHttpClient) httpclient).setHttp
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();
}
当我使用wifi发送http请求时,一切正常,我会得到响应。但是,当我使用蜂窝移动数据时,它会打断行HttpResponse response=httpclient.execute(httpPost)代码>并给出以下错误:
java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)