Q: HTTP through multiple NICs

Gardiner, Geoff ggardiner at accelrys.com
Mon Jul 16 04:08:28 EDT 2001


Thank you, this looks exactly like what I need. I'd looked through the
sources for httplib, etc, including socket.py and had not encountered 'bind'
at all - I should have properly RTFM as well.

I'd also not spotted that I should be using HTTPConnection rather than HTTP
until you pointed it out - though HTTP actually _uses_ HTTPConnection, just
proclaiming itself to be HTTP/1.0.

Geoff

-----Original Message-----
From: ngps at madcap.dyndns.org [mailto:ngps at madcap.dyndns.org]
Sent: 13 July 2001 18:42
To: python-list at python.org
Subject: Re: Q: HTTP through multiple NICs
...
To do what you want, insert "s.bind((local_addr, local_port))" between
lines 1 and 2. Yes, bind() works for client sockets, too.
...
A quick glance thru httplib shows no mechanism to pass your own socket
objects in - httplib's HTTP and HTTPConnection classes want to create their
own sockets. 

You can subclass either of those (use HTTPConnection, it's newer ;-) to pass
in your own sockets that bind to your choice of local address.
...




More information about the Python-list mailing list