which outgoing network device/IP is used?

Дамјан Г. пенгуиниста at маил?=.=?iso-8859-5?Q?нет?=.=?iso-8859-5?Q?мк
Thu Oct 10 15:29:11 EDT 2002


> if a computer has more network devices I want to know which one (IP) is used
> for a outgoing socket connection to a certain remote host. (in order to
> 'bind/accept' later on that IP for an incoming connection request)

sc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sc.connect(('www.google.com', 80))
sc.getpeername() # google's IP and port
sc.getsockname() # yours IP and port





-- 
Дамјан

      There are three kind of lies: lies, damn lies and benchmarks.




More information about the Python-list mailing list