src/utils/net: Fix our method of determining whether an IPV6 or IP socket is needed.

This commit is contained in:
James Vega 2005-08-22 18:52:37 +00:00
parent da762194ff
commit ef3e002db3

View File

@ -42,7 +42,8 @@ def getSocket(host):
"""Returns a socket of the correct AF_INET type (v4 or v6) in order to
communicate with host.
"""
host = socket.gethostbyname(host)
addrinfo = socket.getaddrinfo(host, None)
host = addrinfo[0][4][0]
if isIP(host):
return socket.socket(socket.AF_INET, socket.SOCK_STREAM)
elif isIPV6(host):