how to get python socket to use a specific interface
Robin Becker
robin at reportlab.com
Tue Oct 27 06:00:46 EDT 2015
On 26/10/2015 22:29, Cameron Simpson wrote:
> On 26Oct2015 12:33, Robin Becker <robin at reportlab.com> wrote:
>> .............
........
>>> $ ifconfig
>>> eth0 Link encap:Ethernet HWaddr 00:.......4 GB)
>>> Interrupt:16
>>>
>>> eth0:0 Link encap:Ethernet HWa.......
>
> Do you need to bind to the device itself? Using the correct IP address should
> normally be sufficient. The system you're talking to won't know anything about
> the device, only the address. Try skipping the device binding step.
>
According to the stackoverflow articles here
http://stackoverflow.com/questions/335607/how-do-i-make-an-outgoing-socket-to-a-specific-network-interface
http://stackoverflow.com/questions/8437726/can-python-select-what-network-adapter-when-opening-a-socket
binding to the local IP seems to be a windows only thing. I have tried just
binding to the local IP, but my packets were from the default address (the one
connected to eth0). After reading the 8437726 article again I think I may be on
the wrong track anyway.
> Cheers,
> Cameron Simpson <cs at zip.com.au>
--
Robin Becker
More information about the Python-list
mailing list