[Twisted-Python] Finding out the IP which it failed to connect

Facundo Batista facundobatista at gmail.com
Thu Jan 19 09:19:47 EST 2012


I have some code that uses a twisted.web.client.HTTPClientFactory.

I've found that because some issues (firewall rules, not relevant to
the problem), I experienced failures to connect.

More specifically, I told it to connect to one particular address, and
because of DNS load distribution, that address converted to several
different IPs, and one of that IPs was not open, so it failed to
connect with a TCPTimedOutError (code 110).

When it failed to connect, it executed the "clientConnectionFailed"
method of HTTPClientFactory, which receives a
twisted.internet.tcp.Connector instance, and the reason of the
failure.

The question is: Is there a way, at that point (when
clientConnectionFailed is called), to find out *to which IP* it failed
to connect?

Thank you very much!

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/



More information about the Twisted-Python mailing list