iob_send(3)
π iob_send β send I/O batch π
okay bestie, welcome to iob_send(3) from the Library Functions Manual β¨ this is the one that actually pushes your whole batch of buffered stuff out the door, no cap πͺπ¨
β¨ SYNTAX β¨
#include <libowfat/iob.h>
int64 iob_send(int64 s,io_batch* b);
π¦ DESCRIPTION π¦
So like. iob_send sends the (rest of) b over the socket s. that's it, that's the whole job π
note the rest of β if you already sent part of it, it just picks up where it left off, it's not re-sending anything, she's efficient like that π«Ά
Here's the tea on what she returns π
- the number of bytes written β yay, progress π
0β there were no more bytes to be written in the batch, we're done here bestie β-1β forEAGAIN, aka "not right now, try again later" π΄-3β a permanent error (for example"connection reset by peer") π that one's for real
The normal usage pattern is using io_wait to know when a descriptor is writable, and then calling iob_send until it returns 0, -1 or -3. it's giving loop energy, iykyk π
And the decision tree is literally so simple, memorise it fr fr:
- If it returns
0, terminate the loop (everything was written OK) π - If it returns
-1, callio_waitagain π - If it returned
-3, signal an error and close the socket π¨
bestie. do not ignore the -3. that socket is gone. close it and move on, no main character denial arc π
Now why is this whole I/O batch API even iconic?? The benefit of the I/O batch API is that it exploits platform specific APIs like FreeBSD's sendfile π The file contents will always be sent in a way that allows the operating systems to perform zero copy TCP, and the buffers will always be sent using as few syscalls as possible and avoiding unnecessary copying (using writev). like... she's out here doing the least amount of work for the most amount of output, we stan an efficient queen πΈπ§
π SEE ALSO π
and that's the page bestie π«Ά this was iob_send(3) from the Library Functions Manual β go forth and send ur batches, mwah πβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms