Python to tell what is the IP of my PC .
tim at tdw.net
Thu Nov 9 01:24:35 CET 2006
On 09/11/06, Nicolas G <nicolasg at gmail.com> wrote:
> On 11/9/06, Tim Williams <tim at tdw.net> wrote:
> > On 8 Nov 2006 15:35:31 -0800, NicolasG <nicolasg at gmail.com> wrote:
> > > How can I use python to get the real IP address of my DSL router (when
> > > my PC is part of the local home LAN) ?
> > The router will the PC's default gateway IP address, if you are on a
> > windows platform, you can view it by typing IPCONFIG (enter) from a
> > command prompt.
> This is the router local IP, I need to get the router "outside" IP witch is
> the real one.
Oh sorry I missed that.
In that case, get a free dynamic hostname from someone like noip.com.
Install their client on your PC. The client will keep the hostname
updated with your "real" external IP address, and you can use
socket.gethostbyname(hostname) to query it.
It will only take a few minutes to set up the NO-IP account and client
More information about the Python-list