tcp通信

客户端

创建tcp套接字
tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

连接服务器
tcp_client.connect((str服务器ip, int端口))

客户端先发消息
tcp_client.send(bytes数据)

客户端收消息
tcp_client.recv(接收字节数)

关闭套接字
tcp_client.close()服务端

写一个udp的服务端

绑定端口
先收消息,再回消息
学习python的第三十天

相关文章:

  • 2021-05-27
  • 2021-10-18
  • 2021-05-01
  • 2021-11-25
  • 2021-06-19
  • 2021-09-26
  • 2021-05-30
  • 2021-09-10
猜你喜欢
  • 2021-08-02
  • 2021-07-07
  • 2021-08-18
  • 2021-06-15
  • 2021-09-16
  • 2021-10-25
  • 2022-01-09
相关资源
相似解决方案