How do I use a TIdUDPClient with a SOCKS Proxy?

Previous  Top  Next

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.