Original Post
Hiya,
I'm currently using asio to read from a socket into a boost::array, and then parsing the fields out. It works but it's a little ugly, and it's prone to breaking.
I've read about using asio::streambuf instead, which seems to be exactly what i need - receive the data, use an istream to pull out the fields and go.
The documentation isn't completely clear to me though - am I expected to read into a single streambuf for each socket, and copy each 'message' out into another array to pass around as needed? Or is it OK to read into a new streambuf for each message, and pass the streambuf itself around inside my application?
Many thanks for any advice.
Cheers, James
I'm currently using asio to read from a socket into a boost::array, and then parsing the fields out. It works but it's a little ugly, and it's prone to breaking.
I've read about using asio::streambuf instead, which seems to be exactly what i need - receive the data, use an istream to pull out the fields and go.
The documentation isn't completely clear to me though - am I expected to read into a single streambuf for each socket, and copy each 'message' out into another array to pass around as needed? Or is it OK to read into a new streambuf for each message, and pass the streambuf itself around inside my application?
Many thanks for any advice.
Cheers, James