This module implements streaming I/O against a Chirp server. In this model, the user can read and write small amounts of data in a continuous stream to or from a remote file. This interface gives higher data throughput than the chirp_reli.h interface, but it is unreliable. If a streaming connection is lost, the client must close it and start all over again. If reliability is more important than performance, use the chirp_reli.h interface instead.
#include <sys/time.h>
#include <stdio.h>
Go to the source code of this file.
Enumerations | |
enum | chirp_stream_mode_t { CHIRP_STREAM_READ, CHIRP_STREAM_WRITE } |
Indicates what mode to be used for opening a stream. More... | |
Functions | |
chirp_stream * | chirp_stream_open (const char *hostport, const char *path, chirp_stream_mode_t mode, time_t stoptime) |
Open a new stream for reading or writing. | |
int | chirp_stream_printf (struct chirp_stream *stream, time_t stoptime, const char *fmt,...) |
Print formatted data to a stream with buffering. | |
int | chirp_stream_readline (struct chirp_stream *stream, char *line, int length, time_t stoptime) |
Read a single line from a stream with buffering. | |
int | chirp_stream_write (struct chirp_stream *stream, const void *data, int length, time_t stoptime) |
Write data to a stream. | |
int | chirp_stream_read (struct chirp_stream *stream, void *data, int length, time_t stoptime) |
Read data from a stream. | |
int | chirp_stream_flush (struct chirp_stream *stream, time_t stoptime) |
Flush buffered data to the stream. | |
int | chirp_stream_close (struct chirp_stream *stream, time_t stoptime) |
Closes a stream. |
|
Indicates what mode to be used for opening a stream.
|
|
Open a new stream for reading or writing. Connects to a named server and creates a stream for reading or writing to the given file.
|
|
Print formatted data to a stream with buffering. Writes formatted data to a stream, just like a standard Unix printf.
|
|
Read a single line from a stream with buffering. Reads a single line terminated by a linefeed (ASCII byte 10). Carriage returns (ASCII byte 13) are ignored and removed from the input.
|
|
Write data to a stream.
|
|
Read data from a stream.
|
|
Flush buffered data to the stream.
|
|
Closes a stream. This routine closes and deallocates all state associated with a stream. Note that a stream may buffer data internally, so the called does not know if all data has been written successfully unless this function returns success.
|