Internet Direct (Indy) Version 9.0.1 Beta
|
procedure MakeSocks5Connection(const AHost: string; const APort: Integer);
MakeSocks5Connection establishes the socket connection for the client, and performs authentication method negotiation as required by the SOCKS version 5 protocol. An EIdSocksAuthMethodError exception will be raised if an unsupported authentication method is returned on the Connection to the proxy server.
MakeSocks5Connection performs client Authentication using the values in Username and Password when authentication method is saUsernamePassword. An EIdSocksServerRespondError exception will be raised when the client is unable to read the authentication status results from the Connection to the proxy server. An EIdSocksAuthError will be raised when an invalid authentication status value is returned on the Connection to the proxy server.
If authentication is required, and successful, MakeSocks5Connection will send the SOCKS connection request packet that specifies the details for the proxied connection. The request packet includes the SOCKS version number, command opcode, address type, destination host name or IP address, and destination port number for the proxied Connection. The destination address and port contain the values specified in AHost and APort.
MakeSocks5Connection will raise an EIdSocksServerRespondError exception when a response cannot be read from the Connection to the proxy server. Other exceptions can be raised when specific values are returned in the result code for the SOCKS reply, and include the following:
An EIdSocksUnknownError exception will be raised if the result code in the SOCKS reply contains an unknown value.