通过Peer Java异常重置连接

时间:2013-06-08 06:38:12

标签: android socks

URL uri = null;
    try
    {
        uri = new URL(aURL);
    }
    catch (MalformedURLException e)
    {
        // TODO Auto-generated catch block
        Log.e("My SOCKET CONNECTION ERROR 1-->>", e.toString());
        e.printStackTrace();
    }

    InetSocketAddress sa = InetSocketAddress.createUnresolved("XXX.XXX.X.XXX", 1080);
    Proxy proxy = new Proxy(Proxy.Type.SOCKS, sa);
    try
    {
        HttpURLConnection conn = (HttpURLConnection) uri.openConnection(proxy);
        conn.connect();
    }
    catch (IOException e)
    {
        // TODO Auto-generated catch block
        Log.e("My SOCKET CONNECTION ERROR 2-->>", e.toString());

        e.printStackTrace();
    }  

这是我的代码,我试图用我们的IP连接SOCKS服务器,但它给了我这个错误:

  

java.net.SocketException:recvfrom failed:ECONNRESET(由对等方重置连接)

为什么这不连接服务器?我的代码连接到SOCKS服务器有什么错误吗?

非常感谢你的帮助!

0 个答案:

没有答案