summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/client.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/paramiko/client.py b/paramiko/client.py
index 7870ea9f..52038bc3 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -273,7 +273,10 @@ class SSHClient (object):
establishing an SSH session
@raise socket.error: if a socket error occurred while connecting
"""
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ if len(hostname.split(':')) > 1:
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ else:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if timeout is not None:
try:
sock.settimeout(timeout)