gpt4 book ai didi

java.net.ConnectException异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:06:09 25 4
gpt4 key购买 nike

当我通过 USB 连接通过 Google Nexus 运行我的应用程序并尝试连接在我的笔记本电脑上运行的网络服务时,我遇到了以下错误,但我能够连接到网络服务。请指教。

     java.net.ConnectException: failed to connect to /192.168.1.122 (port 8080):       
connect failed: ENETUNREACH (Network is unreachable)

at libcore.io.IoBridge.connect(IoBridge.java:114)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.Socket.startupSocket(Socket.java:566)
at java.net.Socket.tryAllAddresses(Socket.java:127)
at java.net.Socket.<init>(Socket.java:177)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)

最佳答案

仅仅因为您将手机连接到计算机并不意味着它会创建网络连接。

创建一个 LAN 在 LAN IP 上运行网络服务。并使用 wifi 连接到它。

关于java.net.ConnectException异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14826497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com