• How do I use SOCKS proxy in delphi?


    TCP
    ======

    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.

    UDP
    ======

    Starting with Indy 10 build 51, we introduced the ability to use a SOCKS with UDP. However, this will only work with SOCKS protocol version 5 and the proxy server must support the UDP Associate method described in RFC 1928 - SOCKS Protocol Version 5.

    1. Create a TIdSocksInfo object and assign it to the TIdUDPClient.TransparentProxy property.
    2. Set the TIdSocksInfo properties as required.
    3. Call TIdUDPClient.OpenProxy just before you use any receive or send calls.
    4. After completing all of your receive and send calls, call TIdUDPClient.CloseProxy.

    or if you are using the optional TIdUDPClient.Connect and TIdUDPClient.Disconnect methods, you can simply:

    1. Create a TIdSocksInfo object and assign it to the TIdUDPClient.TransparentProxy property.
    2. Set the TIdSocksInfo properties as required.
    3. Call the TIdUDPClient.Connect method and it will open a connection to your proxy and call TIdUDPClient.Disconnect to close the connection to the proxy.

  • 相关阅读:
    Java 集合类
    Java 中的四种引用及垃圾回收策略
    Java 类的加载过程(阿里面试题)
    JMeter进行一次简单的压力测试
    python使用 HTMLTestRunner.py生成测试报告
    python读取配置文件
    python的IDE工具-- Pycharm
    selenium webdriver+python基本操作
    SQL开发测试使用基础
    python学习笔记
  • 原文地址:https://www.cnblogs.com/allegro/p/4952986.html
走看看 - 开发者的网上家园