0
다음 코드를 실행하면 대부분의 경우 "피어에 의한 연결 재설정"예외가 발생합니다.대부분의 경우 내 안드로이드 응용 프로그램에서 피어 예외로 연결 재설정을받습니다.
String rest = System.setProperty("http.keepAlive", "false");
String uri = WEB_LOG_IN + "?user_username=" + user_email
+ "&user_password=" + user_pass + "&user_mac=" + user_mac;
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(uri);
HttpResponse response;
String s;
try {
response = client.execute(httppost);
s = new String(EntityUtils.toByteArray(response.getEntity()),
"UTF-8");
// read json
if (s.length() > 2)
return readlogin_info(s);
else
return false;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
String rest = System.setProperty("http.keepAlive", "false");
반환에는 "http.keepAlive"속성을 의미하는 null로.
httpurlconnection을 사용해 보았지만 작동하지 않았습니다.
코드가 일부 ISP에서는 문제없이 작동한다고 생각하기 때문에 혼란 스럽습니다.
내 조사! String pro = System.getProperty ("http.keepAlive"); \t String rest = System.setProperty ("http.keepAlive", "false"); 은 장치가 (Mikrotik RB951Ui 라우터)를 통해 인터넷에 연결될 때 null을 반환하는 경우가 있습니다. –