Functions | |
peak_stream | peak_stream_socket_create (struct sockaddr *name, int namelen, uint32_t opt, peak_stream_event_callback cb, void *context) |
Creates a new socket stream from a socket address. | |
peak_stream | peak_stream_accept_create (peak_stream ss, uint32_t opt, peak_stream_event_callback cb, void *context) |
Creates a new socket stream from a incoming connection on a listening stream. | |
peak_stream | peak_stream_raw_create (int fd, uint32_t opt, peak_stream_event_callback cb, void *context) |
Creates a new socket stream from a "raw" file descriptor (which must be a valid opened socket). | |
int | peak_stream_is_open (peak_stream s) |
Test is a socket stream is open. | |
int | peak_stream_get_error (peak_stream s) |
Get last stream system error code. | |
int | peak_stream_get_address (peak_stream s, struct sockaddr *name, int *namelen) |
Get peer's name (address). | |
int | peak_stream_set_address (peak_stream s, struct sockaddr *name, int namelen) |
Assign a name (address) to an unnamed socket. | |
int | peak_stream_connect (peak_stream s) |
Connect the stream. | |
void | peak_stream_disconnect (peak_stream s) |
Disconnect the stream. | |
void * | peak_stream_get_context (peak_stream s) |
Get the context pointer of a stream. | |
void | peak_stream_set_context (peak_stream s, void *context) |
Change the context pointer of a stream. | |
size_t | peak_stream_get_read_count (peak_stream s) |
Get amount of bytes actually read from the stream. | |
size_t | peak_stream_get_write_count (peak_stream s) |
Get amount of bytes actually written to the stream. | |
void | peak_stream_set_timeout (peak_stream s, int timeout) |
Configure event timeout checking for a specified stream. |
|
Creates a new socket stream from a incoming connection on a listening stream.
|
|
Connect the stream.
|
|
Disconnect the stream.
|
|
Get peer's name (address).
|
|
Get the context pointer of a stream.
|
|
Get last stream system error code. Returns the last socket or system error code as defined in sys/errno.h.
|
|
Get amount of bytes actually read from the stream. Statistical function.
|
|
Get amount of bytes actually written to the stream. Statistical function.
|
|
Test is a socket stream is open. An open stream is a connected socket for connection oriented streams.
|
|
Creates a new socket stream from a "raw" file descriptor (which must be a valid opened socket).
|
|
Assign a name (address) to an unnamed socket.
This function allow you to bind the stream to a local address which is not the default (eg. for a vhost). Not for use with streams with the
|
|
Change the context pointer of a stream.
|
|
Configure event timeout checking for a specified stream. This is a convenience feature. First, because an explicit timer isn't needed to check stream's timeout in your application anymore. But for thread safety too: when peak is not explicitely configured to use only one thread, an independant timer might be processed at the same time with an event on the stream, so you need to add mutual exclusive region (implementation is possible with peak_task_exclusivity()), and verify all it's well synchronized. With peak_stream_set_timeout() however, the timeout event acts like a normal stream events and cannot be processed at the same time with another on the same stream.
|
|
Creates a new socket stream from a socket address.
|