[Tutor] IP Address from Python module?

Joseph Quigley cpu.crazy at gmail.com
Mon Aug 8 16:22:42 CEST 2005


Danny Yoo wrote:

>Hi Joe,
>
>That actually sounds right in a sense.  Any internet address with
>'192.168.x.x' is a "local" IP address, and is commonly allocated to folks
>on an internal network.  For the really dull details about this, see RFC
>1918 on "Private Address Space":
>
>    http://www.faqs.org/rfcs/rfc1918.html
>
>So anything with 192.168.x.x is a private, internal address.  In the
>context of the Internet, it's sorta useless, since it's not an address
>that one can use to connect to an external machine outside of the local
>area network.
>
>In fact, Brian Hammon's comment in:
>
>    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/335890
>
>does mention that if you're behind a router, then the router itself sets
>up a small private network, which may explain why you may be seeing
>'192.168.x.x' as an address.
>
>The second comment on the cookbook page shows an alternative technique
>that should be more robust: use http://checkip.dyndns.org.
>
>
>
>  
>
>>My internet IP should be IPv6 and I don't think it changes...
>>    
>>
>
>Are you sure about that?  IPv6 has not been widely deployed yet; most
>folks still connect to the internet through the IPv4 protocol.
>
>On the off-chance that you ARE on IPv6, see the getaddrinfo() function,
>which should accomodate:
>
>    http://www.python.org/doc/lib/module-socket.html#l2h-2592
>
>For example:
>
>######
>  
>
>>>>import socket
>>>>socket.getaddrinfo('hkn.eecs.berkeley.edu', 80)
>>>>        
>>>>
>[(2, 1, 6, '', ('128.32.47.228', 80)),
> (2, 2, 17, '', ('128.32.47.228', 80))]
>######
>
>
>Good luck to you!
>
>
>  
>
Thank you. And thank you for the links. Well I remember something on a 
game I played and it had a IPv6 address (refering to my computer while o 
nthe internet).. of course I bought my computer parts in October 2004 so 
there could be a good chance that I do not have IPv6... either way, 
thanks. :-)

Oh and I don't have a router... just a good old-fashioned  CAT5 hub.

Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050808/4a3f325f/attachment.htm


More information about the Tutor mailing list