[Python-3000] IPv6 address tuple

Erno Kuusela erno at iki.fi
Tue Apr 3 08:47:36 CEST 2007


On Sat, 24 Mar 2007, Jun-ichiro itojun Hagino wrote:

| > 	i understand your concern.  current 4-tuple is direct mapping from
| > 	struct sockaddr_in6 (which has those two additional members).
| 	note however, you must rewrite DNS resolving from gethostby* to
| 	get*info anyways, so i'm not too sure if the number of tuple members in
| 	sockaddr matters that much.

This is true when using explicit DNS resolving, but Python socket API
allows you to pass in a string in place of the address in the tuple,
and then resolves it to an address behind your back. This
is probably the most common way of using DNS in Python.

It seems that when you have an AF_INET6 socket, it looks for
an AAAA record, and when you have an AF_INET socket, it goes for A.

Unfortunately this bumps the address family-agnostic get*info API
to second place in the convenience-of-use competition
(getaddrinfo example at <http://docs.python.org/lib/socket-example.html>).

  -- erno

More information about the Python-3000 mailing list