how to get my internet ip address?

Joshua Muskovitz joshm at taconic.net
Sat Jan 26 02:29:53 EST 2002


Gerhard,

This might be of interest to you for use on your gateway machine:

import socket
hostname = socket.gethostname()
addresses = socket.getaddrinfo(hostname, None)
ips = [x[4][0] for x in addresses]

This should give you all of the IP addresses for your machine.  You would
then have to determine which one was out to the universe, of course.

--
# Joshua Muskovitz
# joshm at taconic.net
def lyyrs(sig): return '-'.join(sig.split()+["ly y'rs"])
lyyrs('Hire me!  I need the work!')




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list