Testing script:
#!/usr/bin/python3 import sys from socket import * hosts = [ None, "localhost", "127.0.0.1", "localhost4", "::1", "localhost6", "195.47.235.3", "2a02:38::1001", "info.nix.cz", "www.google.com", ] for host in hosts: print("getaddrinfo host=\"{}\" hints.ai_flags=AI_ADDRCONFIG:".format(host)) try: for item in getaddrinfo(host, "http", AF_UNSPEC, SOCK_STREAM, SOL_TCP, AI_ADDRCONFIG): print(" {}".format(item[4][0])) except gaierror as error: print(" !! {} !!".format(error))
Testing script:
#!/usr/bin/python3 38::1001" , google. com", "getaddrinfo host=\"{}\" hints.ai_ flags=AI_ ADDRCONFIG: ".format( host)) item[4] [0]))
import sys
from socket import *
hosts = [
None,
"localhost",
"127.0.0.1",
"localhost4",
"::1",
"localhost6",
"195.47.235.3",
"2a02:
"info.nix.cz",
"www.
]
for host in hosts:
print(
try:
for item in getaddrinfo(host, "http", AF_UNSPEC, SOCK_STREAM, SOL_TCP, AI_ADDRCONFIG):
print(" {}".format(
except gaierror as error:
print(" !! {} !!".format(error))