logoalt Hacker News

rwmjtoday at 8:27 AM1 replyview on HN

I'm surprised the article didn't also mention MSG_MORE. On Linux it hints to the kernel that "more is to follow" (when sending data on a socket) so it shouldn't send it just yet. Maybe you need to send a header followed by some data. You could copy them into one buffer and use a single sendmsg call, but it's easier to send the header with MSG_MORE and the data in separate calls.

(io_uring is another method that helps a lot here, and it can be combined with MSG_MORE or with preallocated buffers shared with the kernel.)


Replies

mgaunardtoday at 10:10 AM

you can already send fragmented data in one system call without copying it to a single buffer.

show 1 reply