更新超时时间为10分钟
log添加数据显示 完善push提示
This commit is contained in:
parent
18ce9210cf
commit
39c35f06a0
12
server.py
12
server.py
@ -190,11 +190,12 @@ CCID:{ccid.decode()}
|
|||||||
# od.append(f"{pp[i].decode()}<--->{i.getpeername()}")
|
# od.append(f"{pp[i].decode()}<--->{i.getpeername()}")
|
||||||
# 可能客户端未断开,导致多个连接指向相同的ccid,故需更新后再遍历打印
|
# 可能客户端未断开,导致多个连接指向相同的ccid,故需更新后再遍历打印
|
||||||
for i in p:
|
for i in p:
|
||||||
od.append(f"{i}<--->{p[i].getpeername()}")
|
od.append(f"{i.decode()}<--->{p[i].getpeername()}")
|
||||||
# print('\r\n'.join(zd))
|
# print('\r\n'.join(zd))
|
||||||
clents = ' \n'+'\r\n'.join(od) if len(od) else ""
|
clents = ' \n'+'\r\n'.join(od) if len(od) else ""
|
||||||
print("在线终端已更新,数量",len(od),clents)
|
t=f"在线终端已更新,数量{len(od)}。{clents}"
|
||||||
s2wx("","",f"在线终端已更新,数量{len(od)}。{clents}")
|
print(t)
|
||||||
|
s2wx("","",t)
|
||||||
|
|
||||||
|
|
||||||
def get_addr(ccid):
|
def get_addr(ccid):
|
||||||
@ -402,7 +403,7 @@ def tt_decode(addr, data):
|
|||||||
|
|
||||||
class MyServer(socketserver.BaseRequestHandler):
|
class MyServer(socketserver.BaseRequestHandler):
|
||||||
def setup(self):
|
def setup(self):
|
||||||
self.request.settimeout(60*2)
|
self.request.settimeout(60*10)
|
||||||
self.err = " "
|
self.err = " "
|
||||||
|
|
||||||
def handle(self): # 回调
|
def handle(self): # 回调
|
||||||
@ -424,8 +425,9 @@ class MyServer(socketserver.BaseRequestHandler):
|
|||||||
break
|
break
|
||||||
add_timestamp()
|
add_timestamp()
|
||||||
s2f.save2file(data)
|
s2f.save2file(data)
|
||||||
t = f"从{str(self.client_address)}接收到新数据,长度{len(data)}字节。"
|
t = f"从{str(self.client_address)}<->[{get_ccid(conn).decode() if get_ccid(conn) else 'None'}]接收到新数据,长度{len(data)}字节。"
|
||||||
print(t)
|
print(t)
|
||||||
|
print(data)
|
||||||
s2wx("","",t)
|
s2wx("","",t)
|
||||||
if tt_decode(conn, data):
|
if tt_decode(conn, data):
|
||||||
self.err= "切断。"
|
self.err= "切断。"
|
||||||
|
Loading…
Reference in New Issue
Block a user