An I/O handle is closed when the last remaining reference to it disappears.
Public Methods | |
IOHandle () | |
Creates an empty handle. | |
IOHandle (int fd) | |
Creates a handler from a file descriptor. | |
int | read (void *buf, unsigned int count) |
Attempts to read bytes into a data buffer. | |
operator bool () const | |
Returns true if this IOHandle is valid. | |
int | read_fully (void *buf, unsigned int count) |
Reads bytes into a data buffer, retrying continually until either end-of-stream or an error Condition. | |
int | write (const void *buf, int count) |
Attempts to write bytes from a data buffer. | |
int | write_fully (const void *buf, unsigned int count) |
Writes bytes from a data buffer, retrying continually until either end-of-stream or an error Condition. | |
int | read (databuf buf, unsigned int count) |
Reads up to count bytes into a data buffer, setting the buffer's length to the number of bytes actually read. | |
int | read_fully (databuf buf, unsigned int count) |
Reads count bytes into a data buffer, retrying continually until either end-of-stream or an error Condition. | |
int | read (databuf buf) |
Reads up to count bytes into a data buffer, up to the maximum length of the buffer. | |
int | read_fully (databuf buf) |
Fills up a data buffer, retrying continually until either end-of-stream or an error Condition. | |
int | write (constbuf in) |
Attempts to write bytes from a data buffer. | |
int | write_fully (constbuf in) |
Writes bytes from a data buffer, retrying continually until either end-of-stream or an error Condition. | |
bool | set_blocking (bool block) |
Sets a handle into blocking or non-blocking mode. | |
Status | stat () const |
Returns the Status of the handle. | |
int | get_fd () const |
Returns the file descriptor. | |
string | as_string () const |
Static Public Methods | |
pair< IOHandle, IOHandle > | pipe () |
Protected Methods | |
void | set_status (const Status &s) |
|
Creates an empty handle.
|
|
Creates a handler from a file descriptor. This should only be invoked once per file descriptor. |
|
|
|
Returns the file descriptor.
|
|
Returns true if this IOHandle is valid.
|
|
|
|
Reads up to count bytes into a data buffer, up to the maximum length of the buffer. Sets the buffer's length to the number of bytes actually read.
|
|
Reads up to count bytes into a data buffer, setting the buffer's length to the number of bytes actually read.
|
|
Attempts to read bytes into a data buffer. This call may block if the handler has not been put into non-blocking mode.
|
|
Fills up a data buffer, retrying continually until either end-of-stream or an error Condition. Sets buf's length to the number of bytes read, which is always either buf.max_length() or 0. This should never be called on a non-blocking Socket because it may consume large of CPU time waiting for bytes.
|
|
Reads count bytes into a data buffer, retrying continually until either end-of-stream or an error Condition. Sets buf's length to the number of bytes read, which is always either count or 0. This should never be called on a non-blocking Socket because it may consume large of CPU time waiting for bytes.
|
|
Reads bytes into a data buffer, retrying continually until either end-of-stream or an error Condition. This should never be called on a non-blocking Socket because it may consume large of CPU time waiting for bytes.
|
|
Sets a handle into blocking or non-blocking mode.
|
|
|
|
Returns the Status of the handle.
|
|
Attempts to write bytes from a data buffer. This call may block if the handler has not been put into non-blocking mode.
|
|
Attempts to write bytes from a data buffer. This call may block if the handler has not been put into non-blocking mode.
|
|
Writes bytes from a data buffer, retrying continually until either end-of-stream or an error Condition. This should never be called on a non-blocking Socket because it may consume large of CPU time waiting for bytes.
|
|
Writes bytes from a data buffer, retrying continually until either end-of-stream or an error Condition. This should never be called on a non-blocking Socket because it may consume large of CPU time waiting for bytes.
|