Reputation:
I cannot figure out how to use proxies with TIdWhois
. Does anybody have a clue for me?
Following Remy's description, I use the following code:
w:=TIdWhois.Create(nil);
p:=TIdConnectThroughHttpProxy.Create(nil);
io:=TIdIOHandlerStack.Create(nil);
p.Host:=<proxy-ip>
p.port:=<proxy-port>
io.TransparentProxy:=p;
w.io:=io;
w.host:=<whois-server>
w.port:=43;
w.WHoIs(<domain>);
Monitoring the ports, it still use my real IP for the request.
What am I doing wrong?
Upvotes: 0
Views: 606
Reputation: 596041
Indy 10 natively supports two types of proxies:
HTTP, via the
TIdConnectThroughHttpProxy
component.
SOCKS 4/4a/5, via the TIdSocksInfo
component.
To use either one of them, you need to:
Assign a
TIdIOHandlerSocket
-derived component, such as TIdIOHandlerStack
, to the
client's IOHandler
property.
Assign the desired proxy component to the TIdIOHandlerSocket.TransparentProxy
property, set its Host
and Port
properties to the Host/Port of the desired proxy server, and enable it accordingly (via the TIdConnectThroughHttpProxy.Enabled
or TIdSocksInfo.Version
property).
Set the client's Host
and Port
properties to the Host/Port of the target server, and then Connect()
and use the client normally.
Upvotes: 1