more getaddrinfo weirdness

Trent Lloyd trent at irc-desk.net
Thu Feb 27 19:42:59 EST 2003


At 10:37 AM 27/02/2003 +0000, you wrote:
>"Trent Lloyd" <trent at irc-desk.net> wrote ...
> > When a IPv4 address is returned, the address tuple contains 2 fields
> > (address, port) but when an IPv6 address comes back it has 4 fields
> > (address, port, 0, 0)
> > 0 and 0 are obviously both 0 and i am unsure of there meanings
> > Bit annoying when you try
> > address, port = addr
> >
> > There doesnt seem to be any mention in the docs, am i missing something?
> >
>Well, most obviously the bit in the 2.3a2 docs that says """For AF_INET6
>address family, a four-tuple (host, port, flowinfo, scopeid) is used, where
>flowinfo and scopeid represents sin6_flowinfo and sin6_scope_id member in
>struct sockaddr_in6 in C. For socket module methods, flowinfo and scopeid
>can be omitted just for backward compatibility. Note, however, omission of
>scopeid can cause problems in manipulating scoped IPv6 addresses. """
>
>The above is quoted from
>
>     http://www.python.org/doc/2.3a2/lib/module-socket.html
>
>which doesn't seem like an unobvious place to look! You'll have to look
>further into the C documentation on your system for further information, I
>fear.

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


>regards
>--
>Steve Holden                                  http://www.holdenweb.com/
>Python Web Programming                 http://pydish.holdenweb.com/pwp/
>Register for PyCon now!            http://www.python.org/pycon/reg.html
>
>
>
>--
>http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list