Streamable tcp connection between client and server. More...
#include <stream.h>
Inherits std::streambuf, and std::iostream.
Public Types | |
enum | access_t { RDONLY, WRONLY, RDWR } |
Public Member Functions | |
void | close (void) |
Close an active stream connection. | |
void | open (const char *command, access_t access, const char **env=NULL, size_t buffering=512) |
Open a stream connection to a pipe service. | |
operator bool () const | |
See if stream connection is active. | |
bool | operator! () const |
See if stream is disconnected. | |
pipestream (const char *command, access_t access, const char **env=NULL, size_t size=512) | |
Create child process and start pipe. | |
pipestream () | |
Create an unopened pipe stream. | |
int | sync (void) |
Flush the stream input and output buffers, writes pending output. | |
void | terminate (void) |
Force terminate child and close. | |
virtual | ~pipestream () |
Destroy a pipe stream. | |
Protected Member Functions | |
int | overflow (int ch) |
This streambuf method is used to write the output buffer through the established pipe connection. | |
void | release (void) |
Release the stream, detach/do not wait for the process. | |
int | uflow () |
This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode. | |
int | underflow () |
This streambuf method is used to load the input buffer through the established pipe connection. | |
Protected Attributes | |
size_t | bufsize |
char * | gbuf |
char * | pbuf |
pid_t | pid |
fsys_t | rd |
fsys_t | wr |
Streamable tcp connection between client and server.
The tcp stream class can represent a client connection to a server or an instance of a service generated by a tcp listener. As a stream class, data can be manipulated using the << and >> operators.
Definition at line 175 of file stream.h.
ucc::pipestream::pipestream | ( | const char * | command, | |
access_t | access, | |||
const char ** | env = NULL , |
|||
size_t | size = 512 | |||
) |
Create child process and start pipe.
command | to pass. | |
access | mode of pipe stream. | |
env | to create in child. | |
size | of buffer. |
void ucc::pipestream::close | ( | void | ) |
Close an active stream connection.
This waits for the child to terminate.
void ucc::pipestream::open | ( | const char * | command, | |
access_t | access, | |||
const char ** | env = NULL , |
|||
size_t | buffering = 512 | |||
) |
Open a stream connection to a pipe service.
command | to execute. | |
access | mode of stream. | |
env | to create in child process. | |
buffering | size to use. |
ucc::pipestream::operator bool | ( | ) | const [inline] |
bool ucc::pipestream::operator! | ( | ) | const [inline] |
int ucc::pipestream::overflow | ( | int | ch | ) | [protected] |
This streambuf method is used to write the output buffer through the established pipe connection.
ch | char to push through. |
int ucc::pipestream::sync | ( | void | ) |
Flush the stream input and output buffers, writes pending output.
int ucc::pipestream::uflow | ( | ) | [protected] |
This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode.
Also this method will handle proper use of buffers if not in interative mode.
int ucc::pipestream::underflow | ( | ) | [protected] |
This streambuf method is used to load the input buffer through the established pipe connection.