• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

HowdoIuseSOCKSproxyindelphi?

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
delphi三层架构简单例子(经测试成功)发布时间:2022-07-18
下一篇:
多个接口出现同名函数的处理(C#,Delphi)发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap