Subject: Re: [boost] Is the async_read more reliable than async_read_some?
From: Cliff Green (cliffg_at_[hidden])
Date: 2018-12-09 01:06:01
>> What kind of delimiter can I use to make async_read_until will work?
>> The server to call async_read_some will be connected by thousands
>> devices, can the async_read_some cope with thousands different messages
>> without causing problems?
>> I've just tried to run async_write using boost streambuf to pack packet
>> header and msgpack data together in one message data, but the async_read
>> in server site could only work a couple of minutes than it crashed even I
>> fixed all sizes in header file. It seems I can only use the
>> async_read_some for a stable server implementation.
Describe your wire protocol, then we (those reading this message thread) can
give you some ideas. There are many ways to do the "message framing" (i.e.
determining the beginning and end of a message), but it all depends on how
the wire protocol is defined.
I assume you know that TCP / IP is a stream oriented protocol. There is no
direct correlation between how many bytes you send and how many (at one
time) will be received on the other end. That's why Asio provides many
different ways to consume the data on read.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk