debian man page for iob_write

Query: iob_write

OS: debian

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

iob_write(3)						     Library Functions Manual						      iob_write(3)

NAME
iob_write - send I/O batch through callback
SYNTAX
#include <iob.h> typedef int64 (*io_write_callback)(int64 s,const void* buf,uint64 n); int64 iob_write(int64 s,io_batch* b,io_write_callback cb);
DESCRIPTION
iob_write sends the (rest of) b through the callback cb, passing s as first argument. cb is expected to behave like io_trywrite(2). This interface is intended to send an I/O batch through a filter, for example to encrypt or compress it. If you just want to send an I/O batch to a socket, use iob_send instead. iob_write returns the number of bytes written, 0 if there were no more bytes to be written in the batch, -1 for EAGAIN, or -3 for a perma- nent error (for example "connection reset by peer"). The normal usage pattern is using io_wait to know when a descriptor is writable, and then calling iob_write until it returns 0, -1 or -3. If it returns 0, terminate the loop (everything was written OK). If it returns -1, call io_wait again. If it returned -3, signal an error.
NOTE
iob_write will continue to call your callback until it returns an error. So if you are in a state machine, for example a web server using this for SSL support, make sure to write at most n bytes at a time (e.g. 64k) and the next time you are called return -1. Otherwise iob_write might not return until the whole file is served.
SEE ALSO
iob_send(3) iob_write(3)
Related Man Pages
array_allocate(3) - debian
io_canread(3) - debian
io_nonblock(3) - debian
iob_write(3) - debian
int64(3o) - minix
Similar Topics in the Unix Linux Community
Creating a batch file.
Append value(batch number) to start of records
How to use we use int64?
Adding or subtracting days from current date in batch script
Perl error in batch command but works one at a time