How set the source IP adress
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Fri Oct 27 13:28:46 EDT 2006
Maksim Kasimov wrote:
> Hi,
>
> how to set source ip-address when do __socket.connect((host, port))
> on a machine that have a several ip-adresses?
>
> many thanks for advice.
>
> __socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> __socket.connect((host, port))
>
>
sock.connect ( ('11.22.33.44', 9999) )
i.e. just put the ip address as string parameter into the connect address tuple
(where you wrote: host)
--Irmen
More information about the Python-list
mailing list