根据 boost::asio::read_until
文档:
After a successful read_until operation, the streambuf may contain additional data beyond the delimiter. An application will typically leave that data in the streambuf for a subsequent read_until operation to examine.
我不明白为什么会这样。
是不是因为在 TCP 协议(protocol)中,如果不读取所有可用字符,就会丢失它们?
最佳答案
因为如果它只读到你想要的字符,它就必须一次读取一个字符。这将是非常低效的。
关于c++ - 我不明白为什么 boost::asio::read_until 读取定界符后面的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45376498/