feat: cd 设置清空缓冲区
This commit is contained in:
parent
108fe0ae9f
commit
8e33e084b4
|
@ -148,6 +148,15 @@ def get_tyy_data(*args):
|
|||
sc.settimeout(5) # 设置超时
|
||||
sc.connect((host, port))
|
||||
sc_all[f"{host}_{port}"] = sc
|
||||
else:
|
||||
# 清空接收缓冲区
|
||||
sc.settimeout(0.1) # 设置短暂超时
|
||||
try:
|
||||
while True:
|
||||
sc.recv(1024)
|
||||
except (socket.timeout, BlockingIOError):
|
||||
pass
|
||||
sc.settimeout(5) # 恢复原超时设置
|
||||
sc.sendall(b"R")
|
||||
except BrokenPipeError:
|
||||
if retry > 0:
|
||||
|
|
Loading…
Reference in New Issue