The AVD test no problem. Times change to the device FileNotFound abnormalities frequently reported this exception. Help us to see.
Code is as follows:
public class HttpAssist {
public static String doPost (JSONObject json) throws IOException {
URL postUrl = new URL (Config.url);
HttpURLConnection connection = (HttpURLConnection) postUrl.openConnection ();
connection.setDoOutput (true);
connection.setDoInput (true);
connection.setRequestMethod ("POST");
connection.setUseCaches (false);
connection.connect ();
OutputStreamWriter out = new OutputStreamWriter (connection
. GetOutputStream ());
out.write (Config.getParameterName + "=" + json.toString ());
out.flush ();
out.close (); / / flush and close
BufferedReader reader = new BufferedReader (new InputStreamReader (connection.getInputStream (), "utf-8"));
String line = "";
String res = "";
while ((line = reader.readLine ())! = null) {
res + = line;
System.out.println (line);
}
reader.close ();
connection.disconnect ();
return res;
}
}
Abnormal follows:

Is not always reported, but often reported this exception. Investigation for a long time have not found something useful. You, to see you. . .
Reply:
Server daemon is not reported an error, such as a 500 error or something.
Reply:
Get current proposal before the judge responseCode 200.
Reply:
good my first try.
Reply:
This is your ip should be, you need this test within the LAN phone with this pc is using the same router!
Reply:
Well yes. Otherwise not visit.
Reply:
Then you'll see the return code to determine the next state
Reply:
The same question, I also encountered this problem. And network access permissions are configured.
No comments:
Post a Comment