3 ms·
Normally it's just a matter of "store a buffer of bytes received and a buffer of bytes to be sent". The "application" part doesn't do syscalls directly, just us
by o11c 3y ago
Normally it's just a matter of "store a buffer of bytes received and a buffer of bytes to be sent". The "application" part doesn't do syscalls directly, just uses the buffers. Then when the application part is done (for now) you go back to the event loop which makes all the syscalls for you.
There is potential for bugs if you try to be "clever" with partially parsing the buffer before all the message's data is received, but this is still far simpler than the kind of bugs we get with async/await.