SOCKS (Socket Secure) is a network protocol that creates a general-purpose TCP tunnel between the client and the SOCKS proxy server. Unlike an HTTP proxy, which only understands HTTP CONNECT tunnelling, a SOCKS proxy can relay any TCP traffic: HTTP, HTTPS, FTP, WebSocket, or custom binary protocols. SOCKS5 also supports UDP traffic and optional username/password authentication.
For web scraping, SOCKS5 proxies are often preferred when the scraper uses libraries that speak directly over TCP rather than via an HTTP proxy setting. They are also used when WebSocket connections must be proxied alongside regular HTTP requests in the same session.
Browser-based scrapers typically route traffic through SOCKS5 proxies by launching the browser with `--proxy-server=socks5://host:port`. This tunnels all browser traffic — including HTTP/2 and QUIC connections — through the proxy, ensuring complete session isolation.