如何将在我的服务器-客户端聊天中重复两次写入的附加文字删除?

2024-05-14 00:53:23 发布

您现在位置:Python中文网/ 问答频道 /正文

每次我写别的东西时,它都会显示出除了新内容之外我已经写的第一句话

def accept_client():
    while True:    
        cli_sock, cli_add = ser_sock.accept()
        uname = cli_sock.recv(1024)
        name,message=uname.split(">")
        CONNECTION_LIST.append((uname, cli_sock))
        print('%s is now connected' %name)
        thread_client = threading.Thread(target = broadcast_usr, args=[uname, cli_sock])
        thread_client.start()

#this is my code from the server of the chat...

Tags: thenameclientaddtrue内容cliis