Why are TcpStream writes async at all? #5288
-
Forgive me if this is a newbie question. I haven't done much with sockets in compiled languages (I've programmed in NodeJS for years, in which you generally don't have to worry about this detail). Why does Tokio's |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
For a little more context, I am writing some code that I want to generalize over |
Beta Was this translation helpful? Give feedback.
-
There is a finite buffer in the kernel of data that is queued up to be written out over the network. The kernel cannot write that data until it confirms that the recipient has already received the previously sent data. If the buffer fills, new writes need to wait. |
Beta Was this translation helpful? Give feedback.
-
Notice that TcpStream has a |
Beta Was this translation helpful? Give feedback.
There is a finite buffer in the kernel of data that is queued up to be written out over the network. The kernel cannot write that data until it confirms that the recipient has already received the previously sent data. If the buffer fills, new writes need to wait.