By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,592 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,592 IT Pros & Developers. It's quick & easy.

Specifying an IP address for outbound connections?

P: n/a
Python seems to default to the main system IP for outbound connections
(such as urllib), but I want to bind to one of my other IPs for
outbound connections.

Any ideas?

Thanks!
Oct 28 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
erikcw wrote:
Python seems to default to the main system IP for outbound connections
(such as urllib), but I want to bind to one of my other IPs for
outbound connections.

Any ideas?
Just use the .bind method of a socket to bind it to a specific address.
If you then want to continue to use urllib, you'll have to override a
lot of classes, or monkey-patch, or use, e.g., PyContext to selectively
replace httplib.HTTPConnection.connect.

Regards,
Martin
Oct 29 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.