mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
Update mw.py
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user