From 39c35f06a0ff13b85899ad02b4471e93bd10d324 Mon Sep 17 00:00:00 2001 From: murmur Date: Thu, 30 Mar 2023 21:07:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=BA10=E5=88=86=E9=92=9F=20log=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=20=E5=AE=8C=E5=96=84push?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index 07a5943..1d29cfa 100755 --- a/server.py +++ b/server.py @@ -190,11 +190,12 @@ CCID:{ccid.decode()} # od.append(f"{pp[i].decode()}<--->{i.getpeername()}") # 可能客户端未断开,导致多个连接指向相同的ccid,故需更新后再遍历打印 for i in p: - od.append(f"{i}<--->{p[i].getpeername()}") + od.append(f"{i.decode()}<--->{p[i].getpeername()}") # print('\r\n'.join(zd)) clents = ' \n'+'\r\n'.join(od) if len(od) else "" - print("在线终端已更新,数量",len(od),clents) - s2wx("","",f"在线终端已更新,数量{len(od)}。{clents}") + t=f"在线终端已更新,数量{len(od)}。{clents}" + print(t) + s2wx("","",t) def get_addr(ccid): @@ -402,7 +403,7 @@ def tt_decode(addr, data): class MyServer(socketserver.BaseRequestHandler): def setup(self): - self.request.settimeout(60*2) + self.request.settimeout(60*10) self.err = " " def handle(self): # 回调 @@ -424,8 +425,9 @@ class MyServer(socketserver.BaseRequestHandler): break add_timestamp() 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(data) s2wx("","",t) if tt_decode(conn, data): self.err= "切断。"