From da968a776d64282a1db03eb57c39f37046f1afa3 Mon Sep 17 00:00:00 2001
From: macos <tengyue.li@100credit.com>
Date: Wed, 17 Jun 2020 19:17:44 +0800
Subject: [PATCH] ipv6 for ipstatus

---
 clients/client-linux.py  | 8 +++-----
 clients/client-psutil.py | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/clients/client-linux.py b/clients/client-linux.py
index ddb4b1e..23c6b15 100755
--- a/clients/client-linux.py
+++ b/clients/client-linux.py
@@ -115,14 +115,12 @@ def tupd():
 def ip_status():
     ip_check = 0
     for i in [CU, CT, CM]:
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.settimeout(1)
         try:
-            s.connect((i, PORBEPORT))
+            s = socket.create_connection((i, PORBEPORT), timeout=1)
+            s.close()
+            del s
         except:
             ip_check += 1
-        s.close()
-        del s
     if ip_check >= 2:
         return False
     else:
diff --git a/clients/client-psutil.py b/clients/client-psutil.py
index 349d6b7..8dcfd46 100755
--- a/clients/client-psutil.py
+++ b/clients/client-psutil.py
@@ -99,14 +99,12 @@ def tupd():
 def ip_status():
     ip_check = 0
     for i in [CU, CT, CM]:
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.settimeout(1)
         try:
-            s.connect((i, PORBEPORT))
+            s = socket.create_connection((i, PORBEPORT), timeout=1)
+            s.close()
+            del s
         except:
             ip_check += 1
-        s.close()
-        del s
     if ip_check >= 2:
         return False
     else: