Main Page | Modules | Data Structures | Data Fields

Non-buffered operations
[Socket streams]


Detailed Description

Low level read/write primitives.


Defines

#define WRITE_FORMAT_BUFFER_SIZE   1024
 Internal library format buffer size.


Functions

int peak_stream_read (peak_stream s, void *buffer, size_t bufsize)
 Read bytes on a stream.

int peak_stream_recvfrom (peak_stream s, void *buffer, size_t bufsize, struct sockaddr *from, int *fromlen)
 Read bytes on a stream (advanced).

int peak_stream_write (peak_stream s, const void *buffer, size_t bufsize)
 Write bytes to a stream.

int peak_stream_write_format (peak_stream s, const char *format,...)
 Format string and write bytes to a stream.

int peak_stream_write_vformat (peak_stream s, const char *format, va_list vl)
 Format string with arguments and write bytes to a stream.

int peak_stream_writev (peak_stream s, const struct iovec *iov, int iovcnt)
 Gather data from iov array and write the bytes to a stream.


Define Documentation

#define WRITE_FORMAT_BUFFER_SIZE   1024
 

Internal library format buffer size.

The length of a message formatted with peak_stream_write_format() or peak_stream_write_vformat() cannot be highter than that.


Function Documentation

int peak_stream_read peak_stream  s,
void *  buffer,
size_t  bufsize
 

Read bytes on a stream.

Parameters:
s The stream reference.
buffer Pointer to an allocated buffer.
bufsize Size of the allocated buffer.
Returns:
The number of bytes actually read or -1 is an error occured.

int peak_stream_recvfrom peak_stream  s,
void *  buffer,
size_t  bufsize,
struct sockaddr *  from,
int *  fromlen
 

Read bytes on a stream (advanced).

Parameters:
s The stream reference.
buffer Pointer to an allocated buffer.
bufsize Size of the allocated buffer.
from Buffer to a sockaddr structure or NULL.
fromlen Length of the "from" buffer.
Returns:
The number of bytes actually read or -1 is an error occured.

int peak_stream_write peak_stream  s,
const void *  buffer,
size_t  bufsize
 

Write bytes to a stream.

Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using peak_stream_set_buffered() and then use peak_stream_write_buffered().

Parameters:
s The stream reference.
buffer The bytes to write.
bufsize Number of bytes to write.
Returns:
The number of bytes which where written or -1 if an error occured.

int peak_stream_write_format peak_stream  s,
const char *  format,
... 
 

Format string and write bytes to a stream.

Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using peak_stream_set_buffered() and then use peak_stream_msgbuf_make().

Parameters:
s The stream reference.
format The format followed by the arguments.
Returns:
The number of bytes which where written or -1 if an error occured.

int peak_stream_write_vformat peak_stream  s,
const char *  format,
va_list  vl
 

Format string with arguments and write bytes to a stream.

Warning: this function doesn't do write-buffered. For that feature, you need to configure the stream for it, using peak_stream_set_buffered() and then use peak_stream_msgbuf_vmake().

Parameters:
s The stream reference.
format The format followed by the arguments.
vl The arguments.
Returns:
The number of bytes which where written or -1 if an error occured.

int peak_stream_writev peak_stream  s,
const struct iovec *  iov,
int  iovcnt
 

Gather data from iov array and write the bytes to a stream.

Parameters:
s The stream reference.
iov A pointer to one or more iovec structures.
iovcnt Number of iovec structures provided.
Returns:
The number of bytes which where written or -1 if an error occured.


Generated on Thu Jan 8 18:16:24 2004 for the PEAK Library by doxygen     SourceForge.net Logo