udp.py 添加close函数用于关闭后台线程,

解决updata_ssh 后台线程无法正常关闭的问题
调整服务器文件列表显示,服务器文件夹显示中文别名
This commit is contained in:
andy
2023-11-05 21:05:49 +08:00
parent 238fd1e6bb
commit eb922ee1aa
7 changed files with 82 additions and 23 deletions

View File

@@ -73,6 +73,8 @@ class myudp(QObject):
def send(self,ip,cmd,recv_num,timeout):
resoult=True
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.udp=udp
self.send_on=True
local_addr = ("", 0)
udp.bind(local_addr)
udp.settimeout(timeout)
@@ -80,6 +82,8 @@ class myudp(QObject):
try:
index=0
while index<recv_num:
if(self.send_on==False):
return False
recv_data = udp.recvfrom(1024)
recv_msg = recv_data[0]
send_addr = recv_data[1]
@@ -136,6 +140,11 @@ class myudp(QObject):
for t in threads:
t.join()
def close(self):
if(self.udp is not None):
self.udp.close()
if(self.send_on is not None):
self.send_on=False