1

I'm using the following Python code to fetch ipv4 and ipv6 addresses information (according to millions of tutorials i went through including https://docs.python.org/3.5/library/socket.html), but i receive only the ipv4 info. My ipv6 connection is ok, i can see my addresses via "ipconfig /all", the host i'm trying to connect to is "akamai.com" (also tried www.python.org and example.org). I have also tried the 0 argument (full range of results) instead of limiting it to socket.AF_INET6 or socket.AF_INET and yet i receive only the ipv4 address

import sys, socket

x = socket.getaddrinfo("akamai.com", 80, socket.AF_INET6, 0, socket.IPPROTO_IP, socket.AI_CANONNAME)

#Expected format (as i found in some examples in this site):

socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)
[(2, 1, 6, '', ('82.94.164.162', 80)),
(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]

I receive only the first tulip (plus the canonical name)

Thanks for your help in advance

  • I'm sorry but I can't reproduce your problem. `socket.getaddrinfo("akamai.com", 80, socket.AF_INET6, 0, socket.IPPROTO_TCP, socket.AI_CANONNAME)` which returns `[(30, 1, 6, 'akamai.com', ('2a02:26f0:ee:18f::22df', 80, 0, 0)), (30, 1, 6, 'akamai.com', ('2a02:26f0:ee:1a4::22df', 80, 0, 0))]` The answers seem to be fine. – Sander Steffann Jan 11 '17 at 17:20
  • Thanks for trying! (i'm actually glad it worked for you) I'll update the post i have further insights. – Marie_Curie Jan 11 '17 at 21:47
  • It works for me too. Are you sure you actually have _global_ IPv6 connectivity? – Michael Hampton Jan 11 '17 at 23:17
  • Having connectivity or not shouldn't influence DNS lookups though... – Sander Steffann Jan 12 '17 at 00:01

0 Answers0