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服务器有什么错误吗?
非常感谢你的帮助!