多个客户端写3个

# 基于tcp并发多线程的客户端,多个客户端都是一样的测试
import socket

phone=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
phone.connect(("127.0.0.1",8080))


while True:
    x=input("客户端:").strip()
    if not x:continue
    phone.send(x.encode("utf8"))

    data=phone.recv(1024)
    print("服务端",data.decode("utf8"))

phone.close()
client1

相关文章:

  • 2022-02-25
  • 2021-09-20
  • 2021-10-21
  • 2022-01-02
  • 2022-12-23
猜你喜欢
  • 2021-05-30
  • 2021-09-27
  • 2021-10-05
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案