check_tcp module: add IPv6 support
@@ -44,6 +44,11 @@ class Py3status:
def check_tcp(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+
+ try:
+ result = sock.connect_ex((self.host, self.port))
+ except socket.gaierror:
+ sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
result = sock.connect_ex((self.host, self.port))
if result:
