more getaddrinfo weirdness

Trent Lloyd trent at irc-desk.net
Thu Feb 27 14:10:34 CET 2003


For example

trent at seven:~/striked-services$ cat test.py
from socket import *
print getaddrinfo("www.6bone.net", "ircd")

and then

trent at seven:~/striked-services$ python test.py
[(10, 1, 6, '', ('3ffe:b00:c18:1::10', 6667, 0, 0)), (2, 1, 6, '', 
('206.123.31.124', 6667))]

clearly theres two address tuples
3ffe:b00:c18:1::10, 6667, 0, 0
and 206.123.31.125, 6667

What are the last two 0's in IPv6 address and how can i handle unpacking with
addres, port = addr ?

The docs dont seem to indicate this behavior

At 05:33 PM 27/02/2003 +0800, you 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?
>
>
>--
>http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list