Functions

Buffered IO with Asynchroneous reads and no unneeded memmoves (the fast ones)
[Stringbuffer, A class for manipulating strings with dynamic buffers]

Functions

int StrBufTCP_read_buffered_line (StrBuf *Line, StrBuf *buf, int *fd, int timeout, int selectresolution, const char **Error)
 Read a line from socket flushes and closes the FD on error.
int StrBufTCP_read_buffered_line_fast (StrBuf *Line, StrBuf *IOBuf, const char **Pos, int *fd, int timeout, int selectresolution, const char **Error)
 Read a line from socket flushes and closes the FD on error.
int StrBufReadBLOBBuffered (StrBuf *Blob, StrBuf *IOBuf, const char **Pos, int *fd, int append, long nBytes, int check, const char **Error)
 Input binary data from socket flushes and closes the FD on error.

Detailed Description

File IO to fill StrBufs; Works with work-buffer shared across several calls; External Cursor to maintain the current read position inside of the buffer the non-fast ones will use memove to keep the start of the buffer the read buffer (which is slower)


Function Documentation

int StrBufReadBLOBBuffered ( StrBuf Blob,
StrBuf IOBuf,
const char **  Pos,
int *  fd,
int  append,
long  nBytes,
int  check,
const char **  Error 
)

Input binary data from socket flushes and closes the FD on error.

Parameters:
Blob put binary thing here
IOBuf the buffer to get the input to
Pos offset inside of IOBuf
fd pointer to the filedescriptor to read
append Append to an existing string or replace?
nBytes the maximal number of bytes to read
check whether we should search for '000
' terminators in case of timeouts
Error strerror() on error
Returns:
numbers of chars read
int StrBufTCP_read_buffered_line ( StrBuf Line,
StrBuf buf,
int *  fd,
int  timeout,
int  selectresolution,
const char **  Error 
)

Read a line from socket flushes and closes the FD on error.

Parameters:
Line the line to read from the fd / I/O Buffer
buf the buffer to get the input to
fd pointer to the filedescriptor to read
timeout number of successless selects until we bail out
selectresolution how long to wait on each select
Error strerror() on error
Returns:
numbers of chars read
int StrBufTCP_read_buffered_line_fast ( StrBuf Line,
StrBuf IOBuf,
const char **  Pos,
int *  fd,
int  timeout,
int  selectresolution,
const char **  Error 
)

Read a line from socket flushes and closes the FD on error.

Parameters:
Line where to append our Line read from the fd / I/O Buffer;
IOBuf the buffer to get the input to; lifetime pair to FD
Pos pointer to the current read position, should be NULL initialized on opening the FD it belongs to.!
fd pointer to the filedescriptor to read
timeout number of successless selects until we bail out
selectresolution how long to wait on each select
Error strerror() on error
Returns:
numbers of chars read or -1 in case of error. "\n" will become 0
 All Classes Variables