What Is a SOCKS Proxy? SOCKS4 and SOCKS5 Explained

A SOCKS proxy relays connections for an app. SOCKS5 can carry TCP traffic for several application protocols and supports UDP relay when both ends implement it.

What SOCKS5 Supports

The SOCKS5 handshake lets a client ask the proxy to reach a destination by domain name, IPv4, or IPv6 address. The protocol supports authentication negotiation. How DNS is resolved depends on the client and its settings. SOCKS5 by itself does not encrypt your traffic.

SOCKS4 vs SOCKS5

SOCKS4 is an older TCP protocol with IPv4 addressing. The SOCKS4a extension adds hostnames. SOCKS5 adds address types, authentication negotiation, and a UDP relay mechanism. Start with the version your app explicitly supports.

VersionDNS and DestinationsAuthenticationIPv6UDP
SOCKS4Client resolves names to IPv4User ID field onlyNoNo
SOCKS4aProxy can resolve a supplied hostnameUser ID field onlyNo native IPv6 address typeNo
SOCKS5Client can send an IP or let the proxy resolve a hostnameNegotiates supported methodsSupported by the protocolUDP ASSOCIATE if both ends support it

SOCKS5 vs HTTP

Choose SOCKS5 if the app expects it or needs a supported connection outside ordinary web traffic. Choose an HTTP proxy when the application specifically calls for one. A host and port are only meaningful alongside a compatible protocol.

How SOCKS5 Handles DNS

SOCKS5 can accept a destination IP or a hostname. With curl --socks5, curl resolves the destination first. With curl --socks5-hostname, curl sends the hostname to the proxy for resolution.

Which side resolves the hostname?
curl optionResolverWhat the proxy receives
--socks5The client’s configured resolverA destination IP address
--socks5-hostnameThe proxy’s configured resolverA destination hostname

With your own SOCKS5 listener running on port 1080 and a test HTTPS destination you control, try the following. Replace the example hostname before running it.

curl -v --socks5 127.0.0.1:1080 https://test.example.com/
curl -v --socks5-hostname 127.0.0.1:1080 https://test.example.com/

Look for whether curl reports a locally or remotely resolved SOCKS5 connection. If both resolutions reach the same server and the proxy allows access, both requests should return that server’s response. This test covers curl, whose other settings and proxy DNS behavior can differ from a browser’s.

Find SOCKS5 Entries

Open the SOCKS5-filtered directory. A listed endpoint can require authentication or stop responding after the provider’s last check.