|
Boost Users : |
Subject: [Boost-users] usage of boost::asio::async_write and boost::asio::buffer
From: Ozgur Ozturk (ozgur7_at_[hidden])
Date: 2009-07-21 06:29:05
Hi,
I am modifying example echo server for my server.
I started to get the attached error, and I suspect I am using buffer
incorrectly since error started after a change there.
I just changed a line from
boost::asio::async_write(socket_,
boost::asio::buffer("1^", 3,
boost::bind(&session::handle_write, this,
boost::asio::placeholders::error));
to
boost::asio::async_write(socket_,
boost::asio::buffer(replyString, replyString.size()),
boost::bind(&session::handle_write, this,
boost::asio::placeholders::error));
I generate the replyString to have results from my database query separated
with ^ signs (which is used to tokenize the replyString on the client
side...)
string replyString="1^";
while(res->next())
{
replyString+=res->getString("nickname")+"^";
}
I checked that replyString.size() is really one more than the final filled
position index in replyString.
Any ideas, suggestions?
TIA,
Best regards,
Ozgur (Oscar) Ozturk
www.DrOzturk.com
Phone: +1 (908) DROZGUR
i.e, +1 (908) 376-9487
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