diff --git a/bernhard/__init__.py b/bernhard/__init__.py
index <HASH>..<HASH> 100644
--- a/bernhard/__init__.py
+++ b/bernhard/__init__.py
@@ -15,8 +15,22 @@ class TransportError(Exception):
 
 class TCPTransport(object):
     def __init__(self, host, port):
-        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        self.sock.connect((host, port))
+        for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
+            af, socktype, proto, canonname, sa = res
+            try:
+                self.sock = socket.socket(af, socktype, proto)
+            except socket.error, e:
+                self.sock = None
+                continue
+            try:
+                self.sock.connect(sa)
+            except socket.error, e:
+                self.sock.close()
+                self.sock = None
+                continue
+            break
+        if self.sock is None:
+            raise TransportError("Could not open socket.")
 
     def close(self):
         self.sock.close()
@@ -58,7 +72,7 @@ class UDPTransport(object):
                 self.sock = socket.socket(af, socktype, proto)
                 self.host = sa[0]
                 self.port = sa[1] 
-            except socket.error as msg:
+            except socket.error, e:
                 self.sock = None
                 continue
             break
Add dual-stack support for TCP transport.