[Twisted-Python] Twisted HTTP client supporting failover for multiple A records?

Reza Lotun rlotun at gmail.com
Thu Jul 15 05:46:00 EDT 2010


Hi Luke,

> Is there any existing support for any Twisted HTTP client to simulate
> the behaviour of all modern browsers in that -- if an address returns
> multiple A records -- and if one IP fails (connection refused, etc) then
> the client attempts a number of the other IPs before giving up?

As for connecting to hosts that resolve to multiple A records - I
presume as a means of load balancing via DNS round robin - I'm not
quite sure this is natively supported in Twisted. I believe since all
TCP connections are mediated via connectTCP hostnames are ultimately
resolved via socket.gethostbyname. I think you really want the support
provided by socket.gethostbyname_ex
(http://docs.python.org/library/socket.html#socket.gethostbyname_ex).

It's a good question though. I'm sure a core dev will come along and
give a proper answer soon ;-)

Cheers,
Reza

-- 
Reza Lotun
mobile: +44 (0)7521 310 763
email:  rlotun at gmail.com
work:   reza at tweetdeck.com
twitter: @rlotun



More information about the Twisted-Python mailing list