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.,
http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/http/client/async_client.cpp)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net