服务端
# coding=utf-8
import tkinter as tk
import time
import socket
import threading
# 服务端发送的消息
def Send_Message():
result = GulSlk.get("1.0", "end")
sock.send(result.encode())
theTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
GulListBox.insert("end", "服务端" + " " + theTime + ":")
GulListBox.insert("end", " " + result)
GulSlk.delete("1.0", "end")
# 接收客户端消息
def Receive_Message(sock,addr):
while True:
info=sock.recv(1024).decode()
theTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
GulListBox.insert("end", "客户端" + " " + theTime + ":")
GulListBox.insert("end", " " + info)
def Sever_init(sock,addr):
print("客户端接入成功")
Threading_one = thread