AMDG On 12/08/2018 04:51 PM, hh h wrote:
"If it uses some kind of delimiter, then async_read_until will work"
What kind of delimiter can I use to make async_read_until will work?
I have no idea. If you don't know already then your protocol is probably not designed to work that way. If you're designing your own protocol, then sending the size first is probably simpler to implement.
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.
How does it crash? There's no fundamental reason why prepending your own header with the size wouldn't work. The only likely issue that I see with this setup is that async_read will receive the entire message and buffer it in memory before it signals completion, which might be a problem if the messages are large. In Christ, Steven Watanabe