Glossary Proxy types
SOCKS5
SOCKS5: SOCKS5 is the current version of the SOCKS proxy protocol. It relays TCP and UDP traffic for any application, supports username and password authentication, and works with IPv6 and remote DNS resolution.
Also called: SOCKS5 proxy, SOCKS v5
Key takeaways
- SOCKS5 is protocol-agnostic: it carries web, email, SSH, game and custom traffic.
- It supports UDP, IPv6 and sending hostnames for the proxy to resolve.
- Authentication is usually username and password (RFC 1929).
- Use remote DNS (socks5h in curl) to avoid DNS leaks.
- SOCKS5 does not encrypt anything by itself.
What is SOCKS5?
SOCKS5 is a proxy protocol defined in RFC 1928 in 1996. A client connects to a SOCKS5 server, negotiates authentication, and asks it to connect to a destination. After that, the server relays data in both directions without interpreting it. Most residential, ISP, datacenter and mobile proxy providers offer a SOCKS5 endpoint next to their HTTP one.
How a SOCKS5 connection works
- Greeting: the client connects (often to port 1080) and lists the authentication methods it supports, such as “no authentication” and “username/password”.
- Method selection: the server chooses one.
- Authentication: for username/password, the client sends credentials as defined in RFC 1929.
- Request: the client sends a CONNECT command (for TCP) or UDP ASSOCIATE (for UDP), with the destination as an IPv4 address, IPv6 address or domain name.
- Relay: the server connects to the destination and replies with a success code. From now on it forwards bytes.
There is also a BIND command for incoming connections, used rarely today (for example by active-mode FTP).
Remote DNS and leaks
If your client sends the destination as a domain name, the SOCKS5 server resolves it, so your own DNS resolver never sees the lookup. If your client resolves the name itself and sends an IP, your ISP’s resolver learns which sites you visit and where you are, a DNS leak. In curl, socks5h:// means “let the proxy resolve hostnames” and socks5:// means “resolve locally”. Browsers and libraries have similar options.
SOCKS5 vs HTTP proxies
| SOCKS5 | HTTP proxy | |
|---|---|---|
| Traffic types | Any TCP, plus UDP | HTTP, HTTPS via CONNECT |
| Header handling | Never touches data | Can add or strip headers on plain HTTP |
| DNS | Local or remote | Proxy resolves for HTTP and CONNECT |
| UDP | Yes | No |
| Setup in scraping libraries | Sometimes needs an extra package | Built in |
When to use SOCKS5
- Non-browser applications: email clients, FTP, SSH, database clients, chat apps.
- UDP traffic: some games, VoIP and DNS over the proxy.
- Antidetect browsers and tools that let you choose, when you prefer remote DNS and zero header changes.
For simple web scraping, HTTP is usually easier, and both give the same IP.
Configuration examples
- curl:
curl -x socks5h://user:[email protected]:1080 https://example.com - Python requests: install
requests[socks], then usesocks5h://user:pass@host:1080in the proxies dict. - SSH:
ssh -D 1080 user@servercreates a local SOCKS5 proxy through your server.
Security notes
SOCKS5 has no encryption. Username/password authentication travels in clear text to the proxy. Protect sensitive data by using HTTPS or another encrypted protocol inside the tunnel, and prefer providers that support IP allowlisting if you worry about credentials being exposed on your network.
Common SOCKS5 error codes
| Code | Meaning | Likely cause |
|---|---|---|
| 0x01 | General failure | Proxy side problem or upstream error |
| 0x02 | Connection not allowed by ruleset | Target blocked by the provider’s policy |
| 0x03 / 0x04 | Network or host unreachable | Exit cannot reach the target, or DNS failed |
| 0x05 | Connection refused | Target port closed |
| 0x07 | Command not supported | Often UDP or BIND on a proxy that only allows CONNECT |
UDP support in practice
SOCKS5 can carry UDP, which matters for some games, VoIP and QUIC based traffic. Many commercial proxies, especially residential pools, only implement CONNECT for TCP. If you need UDP, ask the provider directly and test it, because a client that falls back to a direct UDP connection can leak your real IP.
Frequently asked questions
Is SOCKS5 better than HTTP?
Not better, more general. SOCKS5 carries any protocol and supports UDP; HTTP proxies are simpler for web traffic and work out of the box in more libraries.
Does SOCKS5 encrypt my traffic?
No. It only relays it. Encryption comes from the protocol you run through it, such as HTTPS.
What port does SOCKS5 use?
Port 1080 is the traditional default, but providers often use other ports.
What is the difference between socks5 and socks5h?
They are client settings, not protocol versions. socks5h sends hostnames to the proxy for resolution; socks5 resolves them on your machine, which can cause a DNS leak.
Can SOCKS5 proxies be residential?
Yes. The protocol is independent of the IP type. Most residential, ISP and mobile providers offer SOCKS5 endpoints.
Why does my browser ignore SOCKS5 authentication?
Chrome and Firefox do not prompt for SOCKS5 usernames and passwords. Use IP whitelisting, a local forwarder that adds the credentials, or an antidetect browser or extension that supports authenticated SOCKS5.