Skip to content
Protocols

SOCKS5 explained: negotiation, addressing, and relay setup

SOCKS5 is a transport-oriented intermediary protocol. It does not require the application payload to be HTTP: after access negotiation, the server can relay a TCP stream or provide the UDP relay defined by the standard. Reliable troubleshooting starts by treating the protocol as several ordered stages rather than one connection attempt.

2 min readReviewed and updated: August 6, 2026

Key points in one minute

  • The access method is negotiated before a command is sent.
  • A destination can be IPv4, a domain name, or IPv6.
  • Reaching the port does not prove that the relay operation succeeded.
  • SOCKS5 reply codes provide more detail than a generic application error.

Method negotiation

The client sends the protocol version and its supported methods. The server selects one or reports that none is acceptable. The selected method's sub-negotiation, such as username and password, must finish before the relay request is made.

Command and destination address

After authorization, the client sends a command, address type, address, and port. The address type removes ambiguity between IPv4, a domain name, and IPv6. Sending a domain name also allows the server side to perform name resolution.

Understanding the reply

The result distinguishes success, policy denial, network or host unreachability, connection refusal, TTL expiry, and unsupported commands. A user interface should translate these outcomes while retaining the original code for technical support.

Capability boundaries

The standard defines CONNECT, BIND, and UDP ASSOCIATE, but a particular server or application may implement only a subset. Verify the required transport against an approved test service instead of assuming every SOCKS client behaves identically.

Practical checklist

  1. 1Select SOCKS5 rather than SOCKS4 when SOCKS5 features are required.
  2. 2Decide where domain names should be resolved.
  3. 3Test authentication and the relay command as separate stages.
  4. 4Record the SOCKS5 reply code in diagnostics.
  5. 5Validate the required traffic type on an authorized test system.

Sources and documentation

This material is based on primary, official, and technical sources. The article is an original summary written for this knowledge base.

  1. 1.RFC Editor / IETF: SOCKS Protocol Version 5
  2. 2.RFC Editor / IETF: Username/Password Authentication for SOCKS V5
  3. 3.curl project: CURLOPT_PROXYTYPE

Continue reading

More articles on related topics

Protocols

HTTP proxies: what happens to a web request

Read

HTTP and TLS

HTTPS through an HTTP proxy: how CONNECT tunneling works

Read

SOCKS5

CONNECT, BIND, and UDP ASSOCIATE in SOCKS5

Read