How do I use a TIdTCPClient with a SOCKS Proxy?

Previous  Top  Next

For Indy 8.0

 

In Delphi, do the following:

 

IdTCPClient1.SocksInfo.Host := [the DNS name of the proxy server or its IP address]

IdTCPClient1.SocksInfo.Protocol := [svNoSocks for no SOCKS support, svSocks4 for SOCKS 4, svSocks4A for SOCKS 4 with protocol extension, and svSocks5 for SOCKS 5 protocol]

IdTCPClient1.SocksInfo.Authentication := [saNoAuthentication for no SOCKS authentication or saUsernamePassword for username and password authentication]

 

In C++Builder, do the following:

 

IdTCPClient1->SocksInfo->Host = [the DNS name of the proxy server or its IP address]

IdTCPClient1->SocksInfo->Protocol = [svNoSocks for no SOCKS support, svSocks4 for SOCKS 4, svSocks4A for SOCKS 4 with protocol extension, and svSocks5 for SOCKS 5 protocol]

IdTCPClient1->SocksInfo->Authentication = [saNoAuthentication for no SOCKS authentication or saUsernamePassword for username and password authentication]

 

For Indy 9.0

 

1.Create an IOHandler such as TIdIOHandlerSocket or TIdSSLIOHandlerSocket and assign the TCPClient.IOHandler property this. 
2.Create a TIdSocksInfo object and assign it to the IOHandler's SocksInfo property.
3.Set the TIdSocksInfo properties as required.

 

For Indy 10

 

1.Create an IOHandler such as TIdIOHandlerStack or SSL IOHandler and assign the TCPClient.IOHandler property this. 
2.Create a TIdSocksInfo object and assign it to the IOHandler's TransparentProxy property.
3.Set the TIdSocksInfo properties as required.
4.If there is another proxy that the SOCKS Proxy itself needs to use, you have to use, set the Chained Proxy to a TIdCustomTransparentProxy such as TIdSocksInfo for another socks Proxy or a TIdConnectThroughHttpProxy for a HTTP Tunneling proxy.

 

See also:

 

How do I use a TIdFTP with a SOCKS proxy?