Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio memory buffers and persistentconnections.
From: Igor R (boost.lists_at_[hidden])
Date: 2009-03-26 09:29:45

> And wouldn't that affect performance in some way?

I can't see how it would affect performance, but the real answer you
will get from performance tests.

> I've read somewhere, that i will not be able to get just the first byte,
> that i would probably get some more

boost::array<char, 1> buff_;// member
socket_.async_receive(boost::asio::buffer(buff), handler);
When the handler() is called, buff_ can't contain more that 1 byte, as
its size is 1 byte.

Of course, you can supply asio::streambuf as a buffer. It's built on
top of std::vector, and it auto-resizes as needed during data
receiving. See asio examples for details. (Eg.,

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at