|
Boost Users : |
Subject: Re: [Boost-users] boost::asio::buffer + std::wstring
From: Luke Walker (luke_walker_at_[hidden])
Date: 2011-12-28 02:43:04
----------------------------------------
> From: boost.lists_at_[hidden]
> Date: Wed, 28 Dec 2011 09:20:48 +0200
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] boost::asio::buffer + std::wstring
>
> Please, don't top-tpost.
>
> > "content", etc are std::wstring objects.
>
> Are you sure they outlive the async operation (eg. aren't they local objects)?
Yes
>
>
> > std::vector reply::to_buffers()
> > {
> > std::vector buffers;
> >
> > buffers.push_back(status_strings::to_buffer(status));
> > buffers.push_back(boost::asio::buffer(misc_strings::crlf));
> > buffers.push_back(boost::asio::buffer(content));
> >
> > return buffers;
> > }
> > and ...
> > request_handler_.handle_request(req, reply_);
> >
> > boost::asio::async_write(socket_, reply_.to_buffers(), strand_.wrap(
> > boost::bind(&connection::handle_write, shared_from_this(), _1))
>
> Check also that you don't call async_write() when another
> async_write() to the same socket is in progress.
The issue isn't writing nor object lifetime. If I use std::string objects the receiver gets all of the content but with std::wstring only 1/4 of the content is received.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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