gpt4 book ai didi

c++ - 在 Windows 中是否有易于实现或现有的协议(protocol)来通过管道/套接字传递对象?

转载 作者:行者123 更新时间:2023-11-27 23:32:59 27 4
gpt4 key购买 nike

对象本质上是动态长度的 BYTE

实现发送/接收机制的最简单方法是什么?

我得到了提示,但不知道如何自己实现此协议(protocol):

Just remember that pipes, like sockets, don't guarantee that everything you put in the pipe will come out the other end in the same number of reads as there were writes. When you read from the pipe or socket you are given what is currently available in the buffer which may not yet be everything that was written so you have to keep reading until you get the expected amount of data.

最佳答案

这一定是多么肮脏的吱吱声?

最简单的情况:

  • 将字节数添加到发送的数据中
  • 继续阅读直到达到字节数

关于c++ - 在 Windows 中是否有易于实现或现有的协议(protocol)来通过管道/套接字传递对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3558061/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com