filedescriptor Class Reference

Inherits input, and output.

Inherited by client, file, serialport, server, and stdiofiledescriptor.

## Public Member Functions

| filedescriptor ()
| filedescriptor (const filedescriptor &f)
filedescriptor & | operator= (const filedescriptor &f)
virtual | ~filedescriptor ()
virtual bool | close ()
int32_t | getFileDescriptor () const
void | setFileDescriptor (int32_t filedesc)
int32_t | duplicate () const
bool | duplicate (int32_t newfd) const
void | setSecurityContext (securitycontext *ctx)
securitycontext * | getSecurityContext ()
virtual bool | supportsBlockingNonBlockingModes ()
virtual bool | useNonBlockingMode () const
virtual bool | useBlockingMode () const
virtual bool | isUsingNonBlockingMode () const
ssize_t | write (uint16_t number)
ssize_t | write (uint32_t number)
ssize_t | write (uint64_t number)
ssize_t | write (int16_t number)
ssize_t | write (int32_t number)
ssize_t | write (int64_t number)
ssize_t | write (float number)
ssize_t | write (double number)
ssize_t | write (unsigned char character)
ssize_t | write (char character)
ssize_t | write (bool value)
ssize_t | write (const unsigned char *string)
ssize_t | write (const char *string)
ssize_t | write (const unsigned char *string, size_t size)
ssize_t | write (const char *string, size_t length)
ssize_t | write (const void *buffer, size_t size)
ssize_t | write (uint16_t number, int32_t sec, int32_t usec)
ssize_t | write (uint32_t number, int32_t sec, int32_t usec)
ssize_t | write (uint64_t number, int32_t sec, int32_t usec)
ssize_t | write (int16_t number, int32_t sec, int32_t usec)
ssize_t | write (int32_t number, int32_t sec, int32_t usec)
ssize_t | write (int64_t number, int32_t sec, int32_t usec)
ssize_t | write (float number, int32_t sec, int32_t usec)
ssize_t | write (double number, int32_t sec, int32_t usec)
ssize_t | write (unsigned char character, int32_t sec, int32_t usec)
ssize_t | write (char character, int32_t sec, int32_t usec)
ssize_t | write (bool value, int32_t sec, int32_t usec)
ssize_t | write (const unsigned char *string, int32_t sec, int32_t usec)
ssize_t | write (const char *string, int32_t sec, int32_t usec)
ssize_t | write (const unsigned char *string, size_t size, int32_t sec, int32_t usec)
ssize_t | write (const char *string, size_t size, int32_t sec, int32_t usec)
ssize_t | write (const void *buffer, size_t size, int32_t sec, int32_t usec)
size_t | printf (const char *format,...)
size_t | printf (const char *format, va_list *argp)
void | safePrint (unsigned char c)
void | safePrint (const unsigned char *str)
void | safePrint (const unsigned char *str, int32_t length)
void | safePrint (char c)
void | safePrint (const char *str)
void | safePrint (const char *str, int32_t length)
void | printBits (unsigned char value)
void | printBits (uint16_t value)
void | printBits (uint32_t value)
void | printBits (uint64_t value)
void | printBits (char value)
void | printBits (int16_t value)
void | printBits (int32_t value)
void | printBits (int64_t value)
void | printBits (const unsigned char *bits, uint64_t size)
ssize_t | read (uint16_t *buffer)
ssize_t | read (uint32_t *buffer)
ssize_t | read (uint64_t *buffer)
ssize_t | read (int16_t *buffer)
ssize_t | read (int32_t *buffer)
ssize_t | read (int64_t *buffer)
ssize_t | read (float *buffer)
ssize_t | read (double *buffer)
ssize_t | read (unsigned char *buffer)
ssize_t | read (char *buffer)
ssize_t | read (bool *buffer)
ssize_t | read (unsigned char *buffer, size_t size)
ssize_t | read (char *buffer, size_t length)
ssize_t | read (void *buf, size_t size)
ssize_t | read (char **buffer, const char *terminator)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes)
ssize_t | read (uint16_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (uint32_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (uint64_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int16_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int32_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (int64_t *buffer, int32_t sec, int32_t usec)
ssize_t | read (float *buffer, int32_t sec, int32_t usec)
ssize_t | read (double *buffer, int32_t sec, int32_t usec)
ssize_t | read (unsigned char *buffer, int32_t sec, int32_t usec)
ssize_t | read (char *buffer, int32_t sec, int32_t usec)
ssize_t | read (bool *buffer, int32_t sec, int32_t usec)
ssize_t | read (unsigned char *buffer, size_t size, int32_t sec, int32_t usec)
ssize_t | read (char *buffer, size_t size, int32_t sec, int32_t usec)
ssize_t | read (void *buf, size_t size, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec)
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec)
int32_t | waitForNonBlockingRead (int32_t sec, int32_t usec) const
int32_t | waitForNonBlockingWrite (int32_t sec, int32_t usec) const
void | retryInterruptedReads ()
void | dontRetryInterruptedReads ()
bool | getRetryInterruptedReads () const
void | retryInterruptedWrites ()
void | dontRetryInterruptedWrites ()
bool | getRetryInterruptedWrites () const
void | retryInterruptedWaits ()
void | dontRetryInterruptedWaits ()
bool | getRetryInterruptedWaits () const
void | retryInterruptedFcntl ()
void | dontRetryInterruptedFcntl ()
bool | getRetryInterruptedFcntl () const
void | retryInterruptedIoctl ()
void | dontRetryInterruptedIoctl ()
bool | getRetryInterruptedIoctl () const
void | allowShortReads ()
void | dontAllowShortReads ()
void | allowShortWrites ()
void | dontAllowShortWrites ()
virtual bool | passFileDescriptor (int32_t fd)
virtual bool | receiveFileDescriptor (int32_t *fd)
virtual bool | passSocket (int32_t sock)
virtual bool | receiveSocket (int32_t *sock)
void | translateByteOrder ()
void | dontTranslateByteOrder ()
virtual int32_t | fCntl (int32_t command, long arg) const
virtual int32_t | ioCtl (int32_t command, void *arg) const
bool | useNaglesAlgorithm ()
bool | dontUseNaglesAlgorithm ()
bool | setSocketWriteBufferSize (int32_t size)
bool | getSocketWriteBufferSize (int32_t *size)
bool | setSocketReadBufferSize (int32_t size)
bool | getSocketReadBufferSize (int32_t *size)
bool | disableIPv4 ()
bool | enableIPv4 ()
const char * | getType () const
char * | getPeerAddress () const
bool | setWriteBufferSize (ssize_t size) const
bool | flushWriteBuffer (int32_t sec, int32_t usec)
bool | setReadBufferSize (ssize_t size) const
bool | closeOnExec ()
bool | dontCloseOnExec ()
bool | getCloseOnExec ()

## Static Public Member Functions

static bool | createPipe (filedescriptor *readfd, filedescriptor *writefd)
static uint16_t | hostToNet (uint16_t value)
static uint32_t | hostToNet (uint32_t value)
static uint64_t | hostToNet (uint64_t value)
static uint16_t | netToHost (uint16_t value)
static uint32_t | netToHost (uint32_t value)
static uint64_t | netToHost (uint64_t value)
static uint16_t | hostToLittleEndian (uint16_t value)
static uint32_t | hostToLittleEndian (uint32_t value)
static uint64_t | hostToLittleEndian (uint64_t value)
static uint16_t | littleEndianToHost (uint16_t value)
static uint32_t | littleEndianToHost (uint32_t value)
static uint64_t | littleEndianToHost (uint64_t value)

## Detailed Description

The filedescriptor class is a base class for other classes that utilize file descriptors.

## Constructor & Destructor Documentation

## filedescriptor() [1/2]

filedescriptor::filedescriptor | ( |  | ) |

Creates an instance of the filedescriptor class.

## filedescriptor() [2/2]

filedescriptor::filedescriptor | ( | const filedescriptor & | f | ) |

Creates an instance of the filedescriptor class that is a copy of "f".

## ~filedescriptor()

virtual filedescriptor::~filedescriptor | ( |  | ) |

virtual

Deletes this instance of the filedescriptor class. Calls close() if it hasn't already been called.

## Member Function Documentation

## allowShortReads()

void filedescriptor::allowShortReads | ( |  | ) |

By default, read() will attempt to read the specified number of bytes from the file descriptor, even if several passes are necessary.

This method causes a read() to attempt only a single pass and return the number of bytes that were read during that pass whether the specified number of bytes were read or not.

Note that reads longer than SSIZE_MAX will only attempt to read SSIZE_MAX bytes.

## allowShortWrites()

void filedescriptor::allowShortWrites | ( |  | ) |

By default, write() will attempt to write the specified number of bytes from the file descriptor, in several passes if necessary.

This method causes a write() to attempt only a single pass and return the number of bytes that were written during that pass whether the specified number of bytes were written or not.

Note that writes longer than SSIZE_MAX will only attempt to write SSIZE_MAX bytes.

## close()

virtual bool filedescriptor::close | ( |  | ) |

virtual

Closes the file descriptor. Returns true on success and false on failure.

Reimplemented in unixsocketserver, unixsocketclient, modemserver, and modemclient.

## closeOnExec()

bool filedescriptor::closeOnExec | ( |  | ) |

If the close-on-exec status is false (the default), then the file descriptor will remain open across an execve() call, otherwise it will be closed.

This method sets the close-on-exec status to true.

## createPipe()

static bool filedescriptor::createPipe | ( | filedescriptor * | readfd,
|  | filedescriptor * | writefd
| ) |  |

static

Creates a pipe and sets "readfd" to the read side and "writefd" to the write side.

## disableIPv4()

bool filedescriptor::disableIPv4 | ( |  | ) |

Disables IPv4 on this file descriptor, only IPv6 will be used. This is only useful for TCP Socket file descriptors. Returns true on success and false on failure.

## dontAllowShortReads()

void filedescriptor::dontAllowShortReads | ( |  | ) |

By default, read() will attempt to read the specified number of bytes from the file descriptor, even if several passes are necessary.

This method causes that default behavior to be observed.

## dontAllowShortWrites()

void filedescriptor::dontAllowShortWrites | ( |  | ) |

By default, write() will attempt to write the specified number of bytes from the file descriptor, even if several passes are necessary.

This method causes that default behavior to be observed.

## dontCloseOnExec()

bool filedescriptor::dontCloseOnExec | ( |  | ) |

If the close-on-exec status is false (the default), then the file descriptor will remain open across an execve() call, otherwise it will be closed.

This method sets the close-on-exec status to false (the default).

## dontRetryInterruptedFcntl()

void filedescriptor::dontRetryInterruptedFcntl | ( |  | ) |

Causes fcntl operations not to be automatically retried if interrupted by a signal. If this is set, a fcntl is occurring and a signal interrupts it, the fcntl fails, the system error is set to EINTR and the fcntl must be retried.

## dontRetryInterruptedIoctl()

void filedescriptor::dontRetryInterruptedIoctl | ( |  | ) |

Causes ioctl operations not to be automatically retried if interrupted by a signal. If this is set, a ioctl is occurring and a signal interrupts it, the ioctl fails, the system error is set to EINTR and the ioctl must be retried.

## dontRetryInterruptedReads()

void filedescriptor::dontRetryInterruptedReads | ( |  | ) |

Causes reads not to automatically retry if interrupted by a signal. This is the default behavior. By default, if a read is occurring and a signal interrupts it, the read fails, the system error is set to EINTR and the read must be retried.

## dontRetryInterruptedWaits()

void filedescriptor::dontRetryInterruptedWaits | ( |  | ) |

Causes wait operations not to be automatically retried if interrupted by a signal. If this is set, a wait is occurring and a signal interrupts it, the wait fails, the system error is set to EINTR and the wait must be retried.

## dontRetryInterruptedWrites()

void filedescriptor::dontRetryInterruptedWrites | ( |  | ) |

Causes writes not to automatically retry if interrupted by a signal. This is the default behavior. By default, if a write is occurring and a signal interrupts it, the write fails, the system error is set to EINTR and the write must be retried.

## dontTranslateByteOrder()

void filedescriptor::dontTranslateByteOrder | ( |  | ) |

Don't translate integers from native byte order to network byte order during writes and vice-versa during reads. This is the default behavior.

## dontUseNaglesAlgorithm()

bool filedescriptor::dontUseNaglesAlgorithm | ( |  | ) |

Causes all write()'s to be sent immediately. (disables Nagle's algorithm)

Returns true on success and false on failure.

## duplicate() [1/2]

int32_t filedescriptor::duplicate | ( |  | ) | const

Duplicates the file descriptor and returns the handle of the duplicate descriptor. The old and new descriptors may be used interchangeably, they share locks, position pointers, flags (except the close-on-exec flag), etc.

Returns the lowest-numbered unused descriptor on success or -1 on failure.

## duplicate() [2/2]

bool filedescriptor::duplicate | ( | int32_t | newfd | ) | const

Sets file descriptor handle "newfd" to be a duplicate of this file descriptor. If "newfd" is already open, it will be closed first.

Returns true on success and false on failure.

## enableIPv4()

bool filedescriptor::enableIPv4 | ( |  | ) |

Enables IPv4 (in addition to IPv6) on this file descriptor (the default). This is only useful for TCP Socket file descriptors. Returns true on success and false on failure.

## fCntl()

virtual int32_t filedescriptor::fCntl | ( | int32_t | command,
|  | long | arg
| ) |  | const

virtual

Use the fcntl() system call to perform various low-level file descriptor operations.

## flushWriteBuffer()

bool filedescriptor::flushWriteBuffer | ( | int32_t | sec,
|  | int32_t | usec
| ) |  |

If an application does many small writes, the overhead of all of those system calls can slow the application down substantially. To address that issue, the filedescriptor class can buffer data passed in to any of it's write() methods and only make system calls when the buffer is full or when it's flushed manually. Note that when using buffered writes, no data is actually written to the file descriptor until the buffer is full or until it's flushed manually.

Do not confuse this buffer with the tcp write buffer. The tcp write buffer resides in kernel space, is populated by the write() system call in an analagous manner and is used to minimize network latency, not application latency due to system calls. This buffer is in user space and populated prior to the write() system call.

This method causes the contents of the write buffer to be written to the filedescriptor immediately.

Returns true on success and false on failure.

If the buffer cannot be flushed within "sec" seconds and "usec" microseconds, then the method will fail. Set either "sec" or "usec" to -1 to disable the timeout and allow the method to block until the buffer has been flushed.

## getCloseOnExec()

bool filedescriptor::getCloseOnExec | ( |  | ) |

If the close-on-exec status is false (the default), then the file descriptor will remain open across an execve() call, otherwise it will be closed.

This method returns true if the close-on-exec status is set to true and false otherwise.

## getFileDescriptor()

int32_t filedescriptor::getFileDescriptor | ( |  | ) | const

Returns the file descriptor.

## getPeerAddress()

char* filedescriptor::getPeerAddress | ( |  | ) | const

Returns the IP address of the client at the other end of the connection if the filedescriptor is an inet socket or NULL otherwise.

Note that the buffer for the address is allocated internally and must be freed by the calling program.

## getRetryInterruptedFcntl()

bool filedescriptor::getRetryInterruptedFcntl | ( |  | ) | const

Returns true if interrupted calls to fcntl will be retried and false otherwise.

## getRetryInterruptedIoctl()

bool filedescriptor::getRetryInterruptedIoctl | ( |  | ) | const

Returns true if interrupted calls to ioctl will be retried and false otherwise.

## getRetryInterruptedReads()

bool filedescriptor::getRetryInterruptedReads | ( |  | ) | const

Returns true if interrupted reads will be retried and false otherwise.

## getRetryInterruptedWaits()

bool filedescriptor::getRetryInterruptedWaits | ( |  | ) | const

Returns true if interrupted waits will be retried and false otherwise.

## getRetryInterruptedWrites()

bool filedescriptor::getRetryInterruptedWrites | ( |  | ) | const

Returns true if interrupted writes will be retried and false otherwise.

## getSecurityContext()

securitycontext* filedescriptor::getSecurityContext | ( |  | ) |

Returns the securitycontext currently associated with the filedescriptor or NULL if none is currently associated.

## getSocketReadBufferSize()

bool filedescriptor::getSocketReadBufferSize | ( | int32_t * | size | ) |

Fetches the size of the kernel's socket read buffer (in bytes) into buffer "size". This is only useful for socket file descriptors. Returns true on success and false on failure.

## getSocketWriteBufferSize()

bool filedescriptor::getSocketWriteBufferSize | ( | int32_t * | size | ) |

Fetches the size of the kernel's socket write buffer (in bytes) into buffer "size". This is only useful for socket file descriptors. Returns true on success and false on failure.

## getType()

const char* filedescriptor::getType | ( |  | ) | const

Returns a string representing the type of the filedescriptor. This is "filedescriptor" by default but a child class may override this method and return something else.

## hostToLittleEndian() [1/3]

static uint16_t filedescriptor::hostToLittleEndian | ( | uint16_t | value | ) |

static

Converts an unsigned 16-bit integer from host byte order to little-endian byte order.

## hostToLittleEndian() [2/3]

static uint32_t filedescriptor::hostToLittleEndian | ( | uint32_t | value | ) |

static

Converts an unsigned 32-bit integer from host byte order to little-endian byte order.

## hostToLittleEndian() [3/3]

static uint64_t filedescriptor::hostToLittleEndian | ( | uint64_t | value | ) |

static

Converts an unsigned 64-bit integer from host byte order to little-endian byte order.

## hostToNet() [1/3]

static uint16_t filedescriptor::hostToNet | ( | uint16_t | value | ) |

static

Converts an unsigned 16-bit integer from host byte order to network byte order (big-endian).

## hostToNet() [2/3]

static uint32_t filedescriptor::hostToNet | ( | uint32_t | value | ) |

static

Converts an unsigned 32-bit integer from host byte order to network byte order (big-endian).

## hostToNet() [3/3]

static uint64_t filedescriptor::hostToNet | ( | uint64_t | value | ) |

static

Converts an unsigned 64-bit integer from host byte order to network byte order (big-endian).

## ioCtl()

virtual int32_t filedescriptor::ioCtl | ( | int32_t | command,
|  | void * | arg
| ) |  | const

virtual

Use the ioctl() system call to perform various low-level file descriptor operations.

Reimplemented in socketserver, and socketclient.

## isUsingNonBlockingMode()

virtual bool filedescriptor::isUsingNonBlockingMode | ( |  | ) | const

virtual

Returns true if the file descriptor is in non-blocking mode and false otherwise.

Reimplemented in socketserver, and socketclient.

## littleEndianToHost() [1/3]

static uint16_t filedescriptor::littleEndianToHost | ( | uint16_t | value | ) |

static

Converts an unsigned 16-bit integer from little-endian byte order to host byte order.

## littleEndianToHost() [2/3]

static uint32_t filedescriptor::littleEndianToHost | ( | uint32_t | value | ) |

static

Converts an unsigned 32-bit integer from little-endian byte order to host byte order.

## littleEndianToHost() [3/3]

static uint64_t filedescriptor::littleEndianToHost | ( | uint64_t | value | ) |

static

Converts an unsigned 64-bit integer from little-endian byte order to host byte order.

## netToHost() [1/3]

static uint16_t filedescriptor::netToHost | ( | uint16_t | value | ) |

static

Converts an unsigned 16-bit integer from network byte order (bit-endian) to host byte order.

## netToHost() [2/3]

static uint32_t filedescriptor::netToHost | ( | uint32_t | value | ) |

static

Converts an unsigned 32-bit integer from network byte order (bit-endian) to host byte order.

## netToHost() [3/3]

static uint64_t filedescriptor::netToHost | ( | uint64_t | value | ) |

static

Converts an unsigned 64-bit integer from network byte order (bit-endian) to host byte order.

## operator=()

filedescriptor& filedescriptor::operator= | ( | const filedescriptor & | f | ) |

Makes this instance of the filedescriptor class identical to "f".

## passFileDescriptor()

virtual bool filedescriptor::passFileDescriptor | ( | int32_t | fd | ) |

virtual

Sends file descriptor "fd" to the file descriptor. This is useful for passing an open file descriptor from one process to another over a unix socket, for example.

## passSocket()

virtual bool filedescriptor::passSocket | ( | int32_t | sock | ) |

virtual

Sends socket "sock" to the file descriptor. This is useful for passing an open socket from one process to another over a unix socket, for example.

## printBits() [1/9]

void filedescriptor::printBits | ( | char | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [2/9]

void filedescriptor::printBits | ( | const unsigned char * | bits,
|  | uint64_t | size
| ) |  |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [3/9]

void filedescriptor::printBits | ( | int16_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [4/9]

void filedescriptor::printBits | ( | int32_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [5/9]

void filedescriptor::printBits | ( | int64_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [6/9]

void filedescriptor::printBits | ( | uint16_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [7/9]

void filedescriptor::printBits | ( | uint32_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [8/9]

void filedescriptor::printBits | ( | uint64_t | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printBits() [9/9]

void filedescriptor::printBits | ( | unsigned char | value | ) |

Prints "value" to the file descriptor as a string of ones and zeros.

## printf() [1/2]

size_t filedescriptor::printf | ( | const char * | format,
|  | va_list * | argp
| ) |  |

Prints "argp" to the filedescriptor using "format" which should comply with standard printf formatting rules.

Note that argp is a pointer to a va_list, not just a va_list.

## printf() [2/2]

size_t filedescriptor::printf | ( | const char * | format,
|  |  | ...
| ) |  |

Prints "..." to the filedescriptor using "format" which should comply with standard printf formatting rules.

## read() [1/33]

ssize_t filedescriptor::read | ( | bool * | buffer | ) |

Reads a boolean value from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

## read() [2/33]

ssize_t filedescriptor::read | ( | bool * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Reads a boolean value from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

## read() [3/33]

ssize_t filedescriptor::read | ( | char ** | buffer,
|  | const char * | terminator
| ) |  |

Reads from the file desciptor into "buffer" until "terminator" is encountered.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read or RESULT_ERROR if an error occurred.

## read() [4/33]

ssize_t filedescriptor::read | ( | char ** | buffer,
|  | const char * | terminator,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Reads from the file desciptor into "buffer" until "terminator" is encountered with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read or RESULT_ERROR if an error occurred.

## read() [5/33]

ssize_t filedescriptor::read | ( | char ** | buffer,
|  | const char * | terminator,
|  | size_t | maxbytes
| ) |  |

Reads from the file desciptor into "buffer" until "terminator" is encountered.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

## read() [6/33]

ssize_t filedescriptor::read | ( | char ** | buffer,
|  | const char * | terminator,
|  | size_t | maxbytes,
|  | char | escapechar,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Reads from the file desciptor into "buffer" until "terminator" is encountered, using "escapechar" as an escape character, with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Setting "escapechar" to '\0' disables it.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

## read() [7/33]

ssize_t filedescriptor::read | ( | char ** | buffer,
|  | const char * | terminator,
|  | size_t | maxbytes,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Reads from the file desciptor into "buffer" until "terminator" is encountered with a timeout of "sec" seconds and "usec" microseconds.

Note that "buffer" is allocated internally and must be freed by the calling program.

Returns the number of bytes that were read, RESULT_ERROR if an error occurred or RESULT_MAX if maxbytes were read before the terminator was encountered.

Setting maxbytes to 0 disables it.

## read() [8/33]

ssize_t filedescriptor::read | ( | char * | buffer | ) |

virtual

Reads an character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [9/33]

ssize_t filedescriptor::read | ( | char * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a character from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [10/33]

ssize_t filedescriptor::read | ( | char * | buffer,
|  | size_t | length
| ) |  |

virtual

Reads "length" characters from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [11/33]

ssize_t filedescriptor::read | ( | char * | buffer,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads "size" characters from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [12/33]

ssize_t filedescriptor::read | ( | double * | buffer | ) |

virtual

Reads a double-precision floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [13/33]

ssize_t filedescriptor::read | ( | double * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a double-precision floating point number from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [14/33]

ssize_t filedescriptor::read | ( | float * | buffer | ) |

virtual

Reads a floating point number from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [15/33]

ssize_t filedescriptor::read | ( | float * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a floating point number from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [16/33]

ssize_t filedescriptor::read | ( | int16_t * | buffer | ) |

virtual

Reads a 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [17/33]

ssize_t filedescriptor::read | ( | int16_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a 16-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [18/33]

ssize_t filedescriptor::read | ( | int32_t * | buffer | ) |

virtual

Reads a 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [19/33]

ssize_t filedescriptor::read | ( | int32_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a 32-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [20/33]

ssize_t filedescriptor::read | ( | int64_t * | buffer | ) |

virtual

Reads a 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [21/33]

ssize_t filedescriptor::read | ( | int64_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads a 64-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [22/33]

ssize_t filedescriptor::read | ( | uint16_t * | buffer | ) |

virtual

Reads an unsigned 16-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [23/33]

ssize_t filedescriptor::read | ( | uint16_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads an unsigned 16-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [24/33]

ssize_t filedescriptor::read | ( | uint32_t * | buffer | ) |

virtual

Reads an unsigned 32-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [25/33]

ssize_t filedescriptor::read | ( | uint32_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads an unsigned 32-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [26/33]

ssize_t filedescriptor::read | ( | uint64_t * | buffer | ) |

virtual

Reads an unsigned 64-bit integer from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [27/33]

ssize_t filedescriptor::read | ( | uint64_t * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads an unsigned 64-bit integer from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [28/33]

ssize_t filedescriptor::read | ( | unsigned char * | buffer | ) |

virtual

Reads an unsigned character from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [29/33]

ssize_t filedescriptor::read | ( | unsigned char * | buffer,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads an unsigned character from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [30/33]

ssize_t filedescriptor::read | ( | unsigned char * | buffer,
|  | size_t | size
| ) |  |

virtual

Reads "size" bytes from the file descriptor into "buffer". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

Implements input.

## read() [31/33]

ssize_t filedescriptor::read | ( | unsigned char * | buffer,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Reads "size" unsigned characters from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from input.

## read() [32/33]

ssize_t filedescriptor::read | ( | void * | buf,
|  | size_t | size
| ) |  |

Reads "size" bytes from the file descriptor into "buf". Returns the number of bytes that were successfully read or RESULT_ERROR if an error occurred.

## read() [33/33]

ssize_t filedescriptor::read | ( | void * | buf,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Reads "size" bytes from the file descriptor into "buffer" with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully read, RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

## receiveFileDescriptor()

virtual bool filedescriptor::receiveFileDescriptor | ( | int32_t * | fd | ) |

virtual

Receives a file descriptor into buffer "fd". This is useful for receiving an open file descriptor passed from another process over a unix socket, for example.

## receiveSocket()

virtual bool filedescriptor::receiveSocket | ( | int32_t * | sock | ) |

virtual

Receives a socket into buffer "sock". This is useful for receiving an open file descriptor passed from another process over a unix socket, for example.

## retryInterruptedFcntl()

void filedescriptor::retryInterruptedFcntl | ( |  | ) |

Causes fcntl operations to be automatically retried if interrupted by a signal. This is the default behavior. Otherwise, if a fcntl is occurring and a signal interrupts it, the fcntl fails, the system error is set to EINTR and the fcntl must be retried.

## retryInterruptedIoctl()

void filedescriptor::retryInterruptedIoctl | ( |  | ) |

Causes ioctl operations to be automatically retried if interrupted by a signal. This is the default behavior. Otherwise, if a ioctl is occurring and a signal interrupts it, the ioctl fails, the system error is set to EINTR and the ioctl must be retried.

## retryInterruptedReads()

void filedescriptor::retryInterruptedReads | ( |  | ) |

Causes reads to automatically retry if interrupted by a signal. By default, if a read is occurring and a signal interrupts it, the read fails, the system error is set to EINTR and the read must be retried.

## retryInterruptedWaits()

void filedescriptor::retryInterruptedWaits | ( |  | ) |

Causes wait operations to be automatically retried if interrupted by a signal. This is the default behavior. Otherwise, if a wait is occurring and a signal interrupts it, the wait fails, the system error is set to EINTR and the wait must be retried.

## retryInterruptedWrites()

void filedescriptor::retryInterruptedWrites | ( |  | ) |

Causes writes to automatically retry if interrupted by a signal. By default, if a write is occurring and a signal interrupts it, the write fails, the system error is set to EINTR and the write must be retried.

## safePrint() [1/6]

void filedescriptor::safePrint | ( | char | c | ) |

Prints "c" to the filedescriptor, however if "c" is non-printing character then it is printed as a hex value of the format: (0x0a). Carriage returns, line feeds and tabs are printed as
, \r and \t.

## safePrint() [2/6]

void filedescriptor::safePrint | ( | const char * | str | ) |

Prints "str" to the filedescriptor, however all non-printing characters are printed as hex values of the format: (0x0a) and carriage returns, line feeds and tabs are printed as
, \r and \t.

## safePrint() [3/6]

void filedescriptor::safePrint | ( | const char * | str,
|  | int32_t | length
| ) |  |

Prints "length" characters of "str" to the filedescriptor, however all non-printing characters are printed as hex values of the format: (0x0a) and carriage returns, line feeds and tabs are printed as
, \r and \t.

## safePrint() [4/6]

void filedescriptor::safePrint | ( | const unsigned char * | str | ) |

Prints "str" to the filedescriptor, however all non-printing characters are printed as hex values of the format: (0x0a) and carriage returns, line feeds and tabs are printed as
, \r and \t.

## safePrint() [5/6]

void filedescriptor::safePrint | ( | const unsigned char * | str,
|  | int32_t | length
| ) |  |

Prints "length" characters of "str" to the filedescriptor, however all non-printing characters are printed as hex values of the format: (0x0a) and carriage returns, line feeds and tabs are printed as
, \r and \t.

## safePrint() [6/6]

void filedescriptor::safePrint | ( | unsigned char | c | ) |

Prints "c" to the filedescriptor, however if "c" is non-printing character then it is printed as a hex value of the format: (0x0a). Carriage returns, line feeds and tabs are printed as
, \r and \t.

## setFileDescriptor()

void filedescriptor::setFileDescriptor | ( | int32_t | filedesc | ) |

Sets the file descriptor associated with the class to "filedesc".

## setReadBufferSize()

bool filedescriptor::setReadBufferSize | ( | ssize_t | size | ) | const

If an application does many small reads, the overhead of all of those system calls can slow the application down substantially. To address that issue, the filedescriptor class can create a read buffer and attempt to keep it full. When the first read is attempted, it will attempt to read "size" bytes into the buffer and only return the number of bytes specified in the read. Subsequent reads will just return data from the buffer without doing additional system calls unless the buffer is empty.

Do not confuse this buffer with the tcp read buffer. The tcp read buffer resides in kernel space, is populated by the read() system call in an analagous manner and is used to minimize network latency, not application latency due to system calls. This buffer is in user space and populated in the manner described above.

This method sets the read buffer size to "size" bytes and returns true on success and false on failure.

## setSecurityContext()

void filedescriptor::setSecurityContext | ( | securitycontext * | ctx | ) |

Associates a securitycontext "ctx" with the filedescriptor. To remove the current context, pass in a NULL for "ctx".

## setSocketReadBufferSize()

bool filedescriptor::setSocketReadBufferSize | ( | int32_t | size | ) |

Sets the size of the kernel's socket read buffer to "size" bytes. This is only useful for socket file descriptors. Returns true on success and false on failure.

## setSocketWriteBufferSize()

bool filedescriptor::setSocketWriteBufferSize | ( | int32_t | size | ) |

Sets the size of the kernel's socket write buffer to "size" bytes. This is only useful for socket file descriptors. Returns true on success and false on failure.

## setWriteBufferSize()

bool filedescriptor::setWriteBufferSize | ( | ssize_t | size | ) | const

If an application does many small writes, the overhead of all of those system calls can slow the application down substantially. To address that issue, the filedescriptor class can buffer data passed in to any of it's write() methods and only make system calls when the buffer is full or when it's flushed manually. Note that when using buffered writes, no data is actually written to the file descriptor until the buffer is full or until it's flushed manually.

Do not confuse this buffer with the tcp write buffer. The tcp write buffer resides in kernel space, is populated by the write() system call and is used to minimize network latency, not application latency due to system calls. This buffer is in user space and populated prior to the write() system call.

This method sets the write buffer size to "size" bytes. A size of 0 means not to buffer writes at all.

Returns true on success and false on failure.

## supportsBlockingNonBlockingModes()

virtual bool filedescriptor::supportsBlockingNonBlockingModes | ( |  | ) |

virtual

Returns true if the client socket supports blocking/nonblocking modes and false otherwise.

Reimplemented in socketserver, and socketclient.

## translateByteOrder()

void filedescriptor::translateByteOrder | ( |  | ) |

Translate integers from native byte order to network byte order during writes and vice-versa during reads. By default, no translation is done.

## useBlockingMode()

virtual bool filedescriptor::useBlockingMode | ( |  | ) | const

virtual

Puts the file descriptor in blocking mode. Returns true on success and false on failure.

Reimplemented in socketserver, and socketclient.

## useNaglesAlgorithm()

bool filedescriptor::useNaglesAlgorithm | ( |  | ) |

Causes small write()'s to be collected up and sent together when either the kernel's write buffer is full or when a maximum of 0.2 seconds has gone by. (enable Nagle's algorithm)

This is the default.

Returns true on success and false on failure.

## useNonBlockingMode()

virtual bool filedescriptor::useNonBlockingMode | ( |  | ) | const

virtual

Puts the file descriptor in non-blocking mode. Returns true on success and false on failure.

Reimplemented in socketserver, and socketclient.

## waitForNonBlockingRead()

int32_t filedescriptor::waitForNonBlockingRead | ( | int32_t | sec,
|  | int32_t | usec
| ) |  | const

Causes the application to wait until a read() will proceed without blocking or until "sec" seconds and "usec" microseconds have elapsed.

Entering -1 for either parameter causes the method to wait indefinitely.

Entering 0 for both parameters causes the method to fall through immediately unless a data is immediately available.

Returns RESULT_ERROR on error, RESULT_TIMEOUT on timeout and otherwise returns the number of file descriptors that are ready to be read from.

This will usually be 1, indicating that the file descriptor represented by the class is ready to be read from.

## waitForNonBlockingWrite()

int32_t filedescriptor::waitForNonBlockingWrite | ( | int32_t | sec,
|  | int32_t | usec
| ) |  | const

Causes the application to wait until a write() will proceed without blocking or until "sec" seconds and "usec" microseconds have elapsed.

Entering -1 for either parameter causes the method to wait indefinitely.

Entering 0 for both parameters causes the method to fall through immediately unless a data is immediately available.

Returns RESULT_ERROR on error, RESULT_TIMEOUT on timeout and otherwise returns the number of file descriptors that are ready to be written to.

This will usually be 1, indicating that the file descriptor represented by the class is ready to be written to.

## write() [1/32]

ssize_t filedescriptor::write | ( | bool | value | ) |

Writes "value" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

## write() [2/32]

ssize_t filedescriptor::write | ( | bool | value,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Writes "value" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

## write() [3/32]

ssize_t filedescriptor::write | ( | char | character | ) |

virtual

Writes "character" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [4/32]

ssize_t filedescriptor::write | ( | char | character,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "character" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [5/32]

ssize_t filedescriptor::write | ( | const char * | string | ) |

virtual

Writes NULL-terminated "string" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [6/32]

ssize_t filedescriptor::write | ( | const char * | string,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes NULL-terminated "string" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [7/32]

ssize_t filedescriptor::write | ( | const char * | string,
|  | size_t | length
| ) |  |

virtual

Writes "length" characters of "string" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred. Note that it is possible to write beyond the string's NULL terminator using this method.

Implements output.

## write() [8/32]

ssize_t filedescriptor::write | ( | const char * | string,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "size" bytes of "string" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred. Note that it is possible to write beyond the string's NULL terminator using this method.

Reimplemented from output.

## write() [9/32]

ssize_t filedescriptor::write | ( | const unsigned char * | string | ) |

Writes NULL-terminated "string" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

## write() [10/32]

ssize_t filedescriptor::write | ( | const unsigned char * | string,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Writes NULL-terminated "string" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

## write() [11/32]

ssize_t filedescriptor::write | ( | const unsigned char * | string,
|  | size_t | size
| ) |  |

virtual

Writes "size" bytes of "string" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred. Note that it is possible to write beyond the string's NULL terminator using this method.

Implements output.

## write() [12/32]

ssize_t filedescriptor::write | ( | const unsigned char * | string,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "size" bytes of "string" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred. Note that it is possible to write beyond the string's NULL terminator using this method.

Reimplemented from output.

## write() [13/32]

ssize_t filedescriptor::write | ( | const void * | buffer,
|  | size_t | size
| ) |  |

Writes "size" bytes of "buffer" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

## write() [14/32]

ssize_t filedescriptor::write | ( | const void * | buffer,
|  | size_t | size,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

Writes "size" bytes of "buffer" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

## write() [15/32]

ssize_t filedescriptor::write | ( | double | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [16/32]

ssize_t filedescriptor::write | ( | double | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [17/32]

ssize_t filedescriptor::write | ( | float | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [18/32]

ssize_t filedescriptor::write | ( | float | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [19/32]

ssize_t filedescriptor::write | ( | int16_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [20/32]

ssize_t filedescriptor::write | ( | int16_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [21/32]

ssize_t filedescriptor::write | ( | int32_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [22/32]

ssize_t filedescriptor::write | ( | int32_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [23/32]

ssize_t filedescriptor::write | ( | int64_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [24/32]

ssize_t filedescriptor::write | ( | int64_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [25/32]

ssize_t filedescriptor::write | ( | uint16_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [26/32]

ssize_t filedescriptor::write | ( | uint16_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [27/32]

ssize_t filedescriptor::write | ( | uint32_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [28/32]

ssize_t filedescriptor::write | ( | uint32_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [29/32]

ssize_t filedescriptor::write | ( | uint64_t | number | ) |

virtual

Writes "number" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [30/32]

ssize_t filedescriptor::write | ( | uint64_t | number,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "number" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.

## write() [31/32]

ssize_t filedescriptor::write | ( | unsigned char | character | ) |

virtual

Writes "character" to the file descriptor. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred.

Implements output.

## write() [32/32]

ssize_t filedescriptor::write | ( | unsigned char | character,
|  | int32_t | sec,
|  | int32_t | usec
| ) |  |

virtual

Writes "character" to the file descriptor with a timeout of "sec" seconds and "usec" microseconds. Returns the number of bytes that were successfully written or RESULT_ERROR if an error occurred or RESULT_TIMEOUT if a timeout occurred.

Reimplemented from output.