diff --git a/paramiko/client.py b/paramiko/client.py index ff31c97..ce14f66 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -273,7 +273,7 @@ class SSHClient (object): establishing an SSH session @raise socket.error: if a socket error occurred while connecting """ - for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port): + for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): if socktype == socket.SOCK_STREAM: af = family addr = sockaddr diff --git a/paramiko/transport.py b/paramiko/transport.py index 3553989..dd04206 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -285,7 +285,7 @@ class Transport (threading.Thread): if type(sock) is tuple: # connect to the given (host, port) hostname, port = sock - for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port): + for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM): if socktype == socket.SOCK_STREAM: af = family addr = sockaddr