Socks Protocol version 5 Working Principles http://www.faqs.org/rfcs/rfc1928.html
Sock5 agent's work program is: (Repost)
1. Need to request information to the proxy server. 2. Agent's response 3. Requires the agent to receive the response to send a target IP and port 4. The agent is connected to the destination 5. The agent will require the information sent by the agent to the target, send the destination The information is transmitted to the agent. The agent is completed.
Since the online information transfer is performed with TCP or UDP, use the SOCKS5 agent to do everything that can be done online, and the purpose of the target will find your IP, which is safe and convenient for SOCK5 support UDP and TCP However, the two agents are different, the following category
How to use a proxy TCP protocol
1. Establish a TCP connection to the 1080 port of the server. 2. Send 05 01 00 (this is 16 into the code, the following) 3. If you receive 05 00, it is a proxy 4. Send 05 01 00 01 destination address (4 bytes) destination port (2) Bytes, destination addresses and ports are 16-entered code (not string !!). Example 202.103.190.27 - 7201 The information sent is: 05 01 00 01 CA 67 BE 1B 1C 21 (CA = 202 67 = 103 BE = 190 1b = 27 1c21 = 7201) 5. Accept the own address and port returned by the server, Connection completion 6. Subsequent operation and direct TCP connection with the destination.
How to connect with a proxy UDP
1. Establish a UDP connection to the server's 1080 port 2. Send 05 01 00 3 to the server. If you receive 05 00, you can proxy 4. Send 05 03 00 01 00 00 00 Local UDP port (2 bytes) 5 the server returns 05,000,001 address port 6. server needs to send the applicant 00,000,001 and destination address IP (4 bytes) destination port 7. the information to be transmitted when there is data packets need to return to the agent Square 00 00 00 01 source address IP (4 bytes) source port acceptable information
Note: This is a proxy protocol that does not require a password, just part of SOCKS5, complete agreement, please RFC1928