Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Syahrul

Thread: Socks 4

  1. #1
    Syahrul is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default Socks 4

    how do you send a connect request to socks4 server?
    this is what i use..
    Java Code:
    		socket = new Socket(_proxy,proxyPort);
    			DataOutputStream writer = new DataOutputStream(socket.getOutputStream());
    	       	BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    
    	
    			writer.writeBytes("4 1 27 88 140 211 166 3 0");
    			writer.flush();
    			String a;
    			while ((a = reader.readLine()) != null) {
    			System.out.println(a);
    			}
    and the output i got..
    HTTP/1.0 404 Proxy Error
    Content-type: text/html
    Pragma: no-cache
    Cache-control: no-cache
    Content-length: 238

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head><title>Proxy Error</title></head>
    <body><h1>Proxy Error</h1>
    The proxy server could not handle this request.
    <p>
    <b>Error reading from remote server</b>
    </body></html>
    i think the method i use to send connect request is wrong..
    so anyone can help?
    tq alot! really appreciate it!

  2. #2
    Syahrul is offline Member
    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Default

    Solved.

    using writer.write(byte[] b, int off, int len)
    and then reader.read() to check for server reply - 0 90 = success
    Rameshwar Soni likes this.

Similar Threads

  1. Socks via HTTP 1.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 06-26-2007, 10:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •