Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum { max_msg = 1024 };
- char read_buffer_[max_msg];
- void do_read()
- {
- async_read(m_sock, buffer(read_buffer_),
- boost::bind(read_complete,_1,_2),
- boost::bind(on_read,_1,_2));
- }
- size_t read_complete(const boost::system::error_code & err, size_t bytes)
- {
- if ( err) return 0;
- bool found = std::find(read_buffer_, read_buffer_ + bytes, 'n') < read_buffer_ + bytes;
- // we read one-by-one until we get to enter, no buffering
- return found ? 0 : 1;
- }
Add Comment
Please, Sign In to add comment