Skip to content

Commit

Permalink
尝试设置端口检测超时时间
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoZuohong committed Nov 21, 2023
1 parent 4b66948 commit 4e06394
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions webview_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def destroy_window():

def is_port_in_use(port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.settimeout(0.1)
return s.connect_ex(("localhost", port)) == 0

if is_port_in_use(port):
Expand Down

0 comments on commit 4e06394

Please sign in to comment.