ip address?
Cliff Wells
logiplexsoftware at earthlink.net
Fri Jan 25 20:32:46 EST 2002
On Sat, 26 Jan 2002 00:55:31 -0000
maximilianscherr wrote:
> thanks,
> but this just returns my lan ip and not my dynamic inet ip
>
> --- In python-list at y..., "Tim Peters" <tim.one at h...> wrote:
> > [maximilianscherr]
> > > how can i get the internet ip address of my connected pc?
> >
> > Give this a try; your money back if it blows up <wink>:
> >
> > import socket
> > myip = socket.gethostbyname(socket.gethostname())
> >
I don't see any way of specifying which interface to use. I suspect you're
going to be stuck with parsing ifconfig/ipconfig.
--
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308
"Then with your new power you'll accomplish all sorts of cool stuff
in no time, and We'll All Be Sorry. At that point you can either
gloat a bit, and then relent, or go ahead and send the robot army
after us." - Quinn Dunkan
More information about the Python-list
mailing list