Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When performing an async_write with a tcp socket, when is the handler called?

This is just a simple question of how async_write behaves with tcp sockets. Basically, when working with a tcp socket, does the write handler get called when the data gets written to the socket, or when an ack is received from the destination?

like image 957
Craig H Avatar asked Jan 18 '26 10:01

Craig H


2 Answers

AFAIK, the handler gets called as soon as data are written into the socket's kernel buffer.

like image 96
Xaqq Avatar answered Jan 21 '26 02:01

Xaqq


Same behavior as the BSD socket's send() - it completes when the OS has a copy of the data. This will be before an ACK.

like image 44
Cory Nelson Avatar answered Jan 21 '26 01:01

Cory Nelson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!