Update mw.py

This commit is contained in:
Mr Chen
2024-11-01 02:29:48 +08:00
parent c04e52d3df
commit 0c9fe565e4
+12
View File
@@ -541,6 +541,18 @@ def isNumber(s):
return False
# 检查端口是否占用
def isOpenPort(port):
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(('127.0.0.1', int(port)))
s.shutdown(2)
return True
except Exception as e:
return False
def debugLog(*data):
if isDebugMode():
print(data)