more getaddrinfo weirdness

Jp Calderone exarkun at intarweb.us
Thu Feb 27 19:53:31 EST 2003


On Fri, Feb 28, 2003 at 08:42:59AM +0800, Trent Lloyd wrote:
> 
> ahh woopsy ;)
> i Was looking under 'getaddrinfo' and not up the top
> 
> How can i handle easily unpacking these then without a case statement or 
> somethign similar to distinguish v4/v6 addresses
> 

  IPv6 isn't compatible with IPv4.  This is a design flaw in IPv6 and not
Python's fault.  Generally, your network code needs to know if it is using
IPv4 or IPv6.  If you really think you can ignore these additional fields,
it is easy to do as...

    address, port = addrinfo[:2]

  Jp

-- 
        "I quite agree with you," said the Duchess; "and the moral of
that is -- Be what you would seem to be' -- or, if you'd like it put
more simply -- Never imagine yourself not to be otherwise than what it
might appear to others that what you were or might have been was not 
otherwise than what you had been would have appeared to them to be
otherwise.'"       -- Lewis Carrol, "Alice in Wonderland"
-- 
 up 19 days, 4:29, 5 users, load average: 0.18, 0.29, 0.40
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030227/834c2a03/attachment.sig>


More information about the Python-list mailing list