急急急。。Android 用wifi,3G网络访问报不同错

代码:
public luntan_ResultComment selectFriend(){
luntan_ResultComment se_friend=new luntan_ResultComment();
final String url="http://169.254.10.92:8080/wancaiweb/SelectFriend";
try {
urlConnection=new URL(url).openConnection();
urlConnection.setRequestProperty("connection","close");
inputStream = urlConnection.getInputStream();
String result=readStream(inputStream);
try {
JSONObject jsonObject=new JSONObject(result);
se_friend.setTotal(jsonObject.getInt("total"));
se_friend.setJsonArray(jsonObject.getJSONArray("comment"));
} catch (JSONException e) {
e.printStackTrace();
}

    } catch (IOException e) {
        e.printStackTrace();
    }

    return se_friend;
}
    我的数据库是SQL2008,服务器是MyEclipse+Tomcat
    我之间在学校是可以正常访问的,但是到家里就不能访问了

wifi访问报错:

07-20 20:59:42.410 14500-14657/java.net.SocketTimeoutException: failed to connect to /169.254.10.92 (port 8080) after 90000ms
07-20 20:59:42.410 14500-14657/com.example.wancai.Activity W/System.err: at libcore.io.IoBridge.connectErrno(IoBridge.java:176)
07-20 20:59:42.411 14500-14657/com.example.wancai.Activity W/System.err: at libcore.io.IoBridge.connect(IoBridge.java:112)
07-20 20:59:42.411 14500-14657/com.example.wancai.Activity W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
07-20 20:59:42.411 14500-14657/com.example.wancai.Activity W/System.err: at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
07-20 20:59:42.412 14500-14657/com.example.wancai.Activity W/System.err: at java.net.Socket.connect(Socket.java:857)
07-20 20:59:42.412 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpConnection.(HttpConnection.java:76)
07-20 20:59:42.412 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpConnection.(HttpConnection.java:50)
07-20 20:59:42.412 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
07-20 20:59:42.413 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
07-20 20:59:42.413 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-20 20:59:42.413 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:316)
07-20 20:59:42.413 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.connect(HttpEngine.java:311)
07-20 20:59:42.414 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
07-20 20:59:42.414 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
07-20 20:59:42.414 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:292)
07-20 20:59:42.414 14500-14657/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpURLConnec

3G访问报错:

java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
07-20 20:57:12.475 10200-13347/com.example.wancai.Activity W/System.err: at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:598)
07-20 20:57:12.475 10200-13347/com.example.wancai.Activity W/System.err: at libcore.io.IoBridge.recvfrom(IoBridge.java:560)
07-20 20:57:12.479 10200-13347/com.example.wancai.Activity W/System.err: at java.net.PlainSocketImpl.read(PlainSocketImpl.java:490)
07-20 20:57:12.480 10200-13347/com.example.wancai.Activity W/System.err: at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
07-20 20:57:12.482 10200-13347/com.example.wancai.Activity W/System.err: at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
07-20 20:57:12.482 10200-13347/com.example.wancai.Activity W/System.err: at java.io.InputStream.read(InputStream.java:163)
07-20 20:57:12.483 10200-13347/com.example.wancai.Activity W/System.err: at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
07-20 20:57:12.490 10200-13347/com.example.wancai.Activity W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
07-20 20:57:12.491 10200-13347/com.example.wancai.Activity W/System.err: at libcore.io.Streams.readAsciiLine(Streams.java:201)
07-20 20:57:12.500 10200-13347/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
07-20 20:57:12.501 10200-13347/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
07-20 20:57:12.502 10200-13347/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:293)
07-20 20:57:12.502 10200-13347/com.example.wancai.Activity W/System.err: at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:185)
07-20 20:57:12.502 10200-13347/com.example.wancai.Activity W/System.err: at com.example.wancai.InternetData.Friend_Data.selectFriend(Friend_Data.java:39)
07-20 20:57:12.502 10200-13347/com.example.wancai.Activity W/System.err: at com.example.wancai.Discover.VerifyFriendNoti.getServerMessage(VerifyFriendNoti.java:165)
07-20 20:57:12.503 10200-13347/com.example.wancai.Activity W/System.err: at com.example.wancai.Discover.VerifyFriendNoti$MessageThrad.run(VerifyFriendNoti.java:107)
07-20 20:57:12.503 10200-13347/com.example.wancai.Activity W/System.err: Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
07-20 20:57:12.504 10200-13347/com.example.wancai.Activity W/System.err: at libcore.io.Posix.recvfromBytes(Native

不知道为什么会报这种错,大神帮帮我

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐