I am developing a tcp client using boost :: asio to handle incoming text that ends with "\ n". However, when I send text containing spaces, it returns all characters after the first space appears. I have already confirmed that the text I'm sending is complete.
This is my code:
boost::system::error_code error; boost::asio::streambuf buffer; boost::asio::read_until( *socket, buffer, "\n", error ); std::istream str(&buffer); std::string s; str >> s;
Pedro source share