问题
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();
}
This is my code that i am trying to connect with SOCKS server with our IP but it gives me this error:
java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
Why is this not connecting to server? Is there any mistake in my Code connecting to SOCKS server?
Thank you so much for your help!
来源:https://stackoverflow.com/questions/16996820/connection-reset-by-peer-java-exception