|
Boost Users : |
Subject: [Boost-users] [Asio] [Boost.ASIO] async_read cannot read full data from client
From: Sarvagya Pant (sarvagya.pant_at_[hidden])
Date: 2015-07-29 00:28:18
*â*
I have a server created using Boost.ASIO (thanks to sehe from
Stackoverflow). The server is supposed to received message from client,
parse it as json and correspondingly send the message back to client. To
make life easier, i have considered very simple cases:
(i) Client can send {"hello":"client"}, server should send response
{"hello":"server"}
(ii) Client can send {"message" : "Some Message"}, server should send
{"response" : "OK"}
The server runs, accepts data from client but cannot call the handler of
async_read. The doc states that
The asynchronous operation will continue until one of the following
conditions is true:
1. The supplied buffers are full. That is, the bytes transferred is equal
to the sum of the buffer sizes.
2. An error occurred.
I think in my case the buffer is not full, thus the handler function is not
getting called. How should I change my code so that server can read the
message sent by client, process it and send back correct response.?
PS: If the code is not attached, http://pastebin.com/pi192t6i is the link
to file.
*-- Sarvagya PantKathmandu, Nepal+9779803468257*
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