weiweideboke

服务端程序:

import socket

phone = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
phone.bind((\'192.168.0.101\',8000))
phone.listen(5)
print("---->")
conn,addr = phone.accept()

msg = conn.recv(1024)
print("客户端发来的消息是:", msg)
conn.send("hello,client".encode("utf-8"))

conn.close()
phone.close()

客户端程序:

import socket

phone = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

phone.connect((\'192.168.0.101\',8000))

phone.send(\'hello,sever\'.encode("utf-8"))
data = phone.recv(1024)
print(" 收到的服务端发来的消息:",data)

  

 

分类:

技术点:

相关文章:

  • 2021-05-06
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2021-08-15
  • 2021-06-11
相关资源
相似解决方案