If that code is as follows
public static String requestPost (String linkAddress, int timeout) {returned by the server state is 200 which is why the visit was a success, but the server does not flow? Flow does exist, I can use the phone to run properly, but with the simulator will not solve? Which setProxy () is set
String result = null;
try {
URL url = new URL (linkAddress);
setProxy ();
HttpURLConnection conn = (HttpURLConnection) url.openConnection ();
conn.setConnectTimeout (timeout * 1000);
conn.connect ();
int state = conn.getResponseCode ();
System.out.println (state);
System.out.println (linkAddress);
if (state == HttpURLConnection.HTTP_OK) {
InputStream in = conn.getInputStream ();
System.out.println ("$ $ $ $ $ $" + in.available ());
BufferedReader reader = new BufferedReader (new InputStreamReader (in, HTTP.UTF_8));
String line = null;
while ((line = reader.readLine ())! = null) {
if (result == null) {
result = line;
} Else {
result + = line;
}
}
}
} Catch (MalformedURLException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
} Catch (IOException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
return result;
}
proxy access through a proxy way
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Top with it. . . . . Do not know?
Reply:
No phone line simulator, then tested using a mobile phone chanting, anyway finally on the phone, not a simulator run.
Reply:
Equipment testing it,
Reply:
The problem is that I do not have android phone. . . . . And this little bug module now points assigned my head how to do this? How to connect successfully stream may be empty yet. . . .
Reply:
Can you take a look at your normal network simulator
Reply:
All functions are normal int state = conn.getResponseCode ();
state = 200
Reply:
Top back up to people seeking answers
Reply:
LZ, did you solve this problem, ah, my question to you the contrary, I can get data on the simulation, not on the phone, the return code is also 200
Can you tell me what is the reason do next
Reply:
I also get inputstream flow ah
Reply:
setProxy (); inside?
Reply:
There have been just like lz problem ah
No comments:
Post a Comment