Gustavo
Gustavo

Reputation: 1019

Boost asio async handler in tcp

Maybe this is a very simple question but I did not find an answer to that. I use boost asios tcp class for handling a simple byte protocol. I do async_read_some and the handler does some work. After the handler has been completed I start another async_read_some. Let's assume this handler does a lot of computing. Is there any posibility that incoming data between the handler work and the next call to async_read_some get lost?

Upvotes: 0

Views: 73

Answers (1)

Stephan Dollberg
Stephan Dollberg

Reputation: 34608

No, your OS would continue receiving data until its receive buffers/TCP receive window are full. Once the receive buffer is full, TCP's flow control will make sure that the sender doesn't send more data than the receiver can receive and such no data will be lost.

See https://www.brianstorti.com/tcp-flow-control/ for a good explanation/example.

https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Flow_control

Upvotes: 1

Related Questions