1
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!

2
  • It is connecting to the server. Then the server is disconnecting while you are writing the request. Commented Jun 20, 2013 at 9:03
  • @EJP.. then it means something is surely wrong at server end.. Am i using the right code to connect to the socket ?? Commented Jun 20, 2013 at 14:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.