boost: readline for tcp client

boost: readline for tcp client

本文关键字:tcp client for readline boost      更新时间:2023-10-16

我正在使用boost在c++中开发tcp服务器。我想逐行处理传入数据,并寻找插座。readLine方法。然而,我只能找到一个read_some()方法。我不知道"some"的定义是什么,但我认为字符串不一定以"n"结尾。

那么我如何使用boost实现socket.readLine() ?

我假设您正在使用boost::asio。如果是,则有一个read_until()函数可以满足您的要求。

http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/reference/read_until.html

read_until

使用boost:: asio: read_until(. .)。