Good afternoon all,
I'm interested in writing a program using asio. I'm new to both boost and asio. Is it possible to use async I/O with streams?
A stream is a good method for what I'm interested in doing but I don't see how to make it work.
What I've got so far:
A class using event driven async I/O. The class parses the data into variable arbitrary sized messages.
I read from the tcp socket into a buffer, then create a stream from the buffer, then deserialize the data from the stream.
unsigned char buffer[1024];
// connect receive event
socket->async_read_some(
boost::asio::buffer(buffer),
boost::bind( &TcpConnection::receive, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred
)
);
I'd like to be able to skip the buffer and just read directly to the stream with an event to notify me of the arrival of data.
Thanks!
--
Cause united breaks guitars
http://www.youtube.com/watch?v=5YGc4zOqozo