.TH "ost::UnixStream" 3 "Wed Oct 31 2018" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::UnixStream \- Unix streams are used to represent Unix domain client connections to a local server for accepting client connections\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBost::Socket\fP, streambuf, and iostream\&. .PP Inherited by \fBost::UnixSession\fP, and \fBost::unixstream\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBUnixStream\fP (\fBUnixSocket\fP &server, int size=512, bool throwflag=true, \fBtimeout_t\fP \fBtimeout\fP=0)" .br .RI "Create a Unix domain stream by accepting a connection from a bound Unix domain socket acting as a server\&. " .ti -1c .RI "\fBUnixStream\fP (const char *pathname, int size=512, bool throwflag=true, \fBtimeout_t\fP to=0)" .br .RI "Create a Unix domain stream by connecting to a Unix domain socket\&. " .ti -1c .RI "void \fBsetTimeout\fP (\fBtimeout_t\fP to)" .br .RI "Set the I/O operation timeout for socket I/O operations\&. " .ti -1c .RI "\fBUnixStream\fP (const \fBUnixStream\fP &source)" .br .RI "A copy constructor creates a new stream buffer\&. " .ti -1c .RI "virtual \fB~UnixStream\fP ()" .br .RI "Flush and empty all buffers, and then remove the allocated buffers\&. " .ti -1c .RI "int \fBsync\fP (void)" .br .RI "Flushes the stream input and output buffers, writes pending output\&. " .ti -1c .RI "bool \fBisPending\fP (\fBPending\fP pend, \fBtimeout_t\fP \fBtimeout\fP=\fBTIMEOUT_INF\fP)" .br .RI "Get the status of pending stream data\&. " .ti -1c .RI "int \fBgetBufferSize\fP (void) const" .br .RI "Return the size of the current stream buffering used\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBUnixStream\fP (bool throwflag=true)" .br .RI "The constructor required for 'unixstream', a more C++ style version of the \fBTCPStream\fP class\&. " .ti -1c .RI "void \fBallocate\fP (int size)" .br .RI "Used to allocate the buffer space needed for iostream operations\&. " .ti -1c .RI "void \fBendStream\fP (void)" .br .RI "Used to terminate the buffer space and cleanup the socket connection\&. " .ti -1c .RI "virtual int \fBunderflow\fP (void)" .br .RI "This streambuf method is used to load the input buffer through the established unix domain socket connection\&. " .ti -1c .RI "int \fBuflow\fP (void)" .br .RI "This streambuf method is used for doing unbuffered reads through the established unix domain socket connection when in interactive mode\&. " .ti -1c .RI "int \fBoverflow\fP (int ch)" .br .RI "This streambuf method is used to write the output buffer through the established unix domain connection\&. " .ti -1c .RI "void \fBconnect\fP (const char *pathname, int size)" .br .RI "Create a Unix domain stream by connecting to a Unix domain socket\&. " .ti -1c .RI "std::iostream * \fBunixstr\fP (void)" .br .RI "Used in derived classes to refer to the current object via it's iostream\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "\fBtimeout_t\fP \fBtimeout\fP" .br .ti -1c .RI "int \fBbufsize\fP" .br .ti -1c .RI "char * \fBgbuf\fP" .br .ti -1c .RI "char * \fBpbuf\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP Unix streams are used to represent Unix domain client connections to a local server for accepting client connections\&. The Unix stream is a C++ 'stream' class, and can accept streaming of data to and from other C++ objects using the << and >> operators\&. .PP Unix Stream itself can be formed either by connecting to a bound network address of a Unix domain server, or can be created when 'accepting' a network connection from a Unix domain server\&. .PP \fBAuthor:\fP .RS 4 Alex Pavloff alex@pavloff.net streamable Unix domain socket connection\&. .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "ost::UnixStream::UnixStream (bool throwflag = \fCtrue\fP)\fC [protected]\fP" .PP The constructor required for 'unixstream', a more C++ style version of the \fBTCPStream\fP class\&. .SS "ost::UnixStream::UnixStream (\fBUnixSocket\fP & server, int size = \fC512\fP, bool throwflag = \fCtrue\fP, \fBtimeout_t\fP timeout = \fC0\fP)" .PP Create a Unix domain stream by accepting a connection from a bound Unix domain socket acting as a server\&. This performs an 'accept' call\&. .PP \fBParameters:\fP .RS 4 \fIserver\fP socket listening\&. .br \fIsize\fP of streaming input and output buffers\&. .br \fIthrowflag\fP flag to throw errors\&. .br \fItimeout\fP for all operations\&. .RE .PP .SS "ost::UnixStream::UnixStream (const char * pathname, int size = \fC512\fP, bool throwflag = \fCtrue\fP, \fBtimeout_t\fP to = \fC0\fP)" .PP Create a Unix domain stream by connecting to a Unix domain socket\&. .PP \fBParameters:\fP .RS 4 \fIpathname\fP path to socket .br \fIsize\fP of streaming input and output buffers\&. .br \fIthrowflag\fP flag to throw errors\&. .br \fIto\fP timeout for all operations\&. .RE .PP .SS "ost::UnixStream::UnixStream (const \fBUnixStream\fP & source)" .PP A copy constructor creates a new stream buffer\&. .PP \fBParameters:\fP .RS 4 \fIsource\fP of copy\&. .RE .PP .SS "virtual ost::UnixStream::~UnixStream ()\fC [virtual]\fP" .PP Flush and empty all buffers, and then remove the allocated buffers\&. .SH "Member Function Documentation" .PP .SS "void ost::UnixStream::allocate (int size)\fC [protected]\fP" .PP Used to allocate the buffer space needed for iostream operations\&. This function is called by the constructor\&. .PP \fBParameters:\fP .RS 4 \fIsize\fP of stream buffers from constructor\&. .RE .PP .SS "void ost::UnixStream::connect (const char * pathname, int size)\fC [protected]\fP" .PP Create a Unix domain stream by connecting to a Unix domain socket\&. .PP \fBParameters:\fP .RS 4 \fIpathname\fP path to socket .br \fIsize\fP of streaming input and output buffers\&. .RE .PP .PP Referenced by ost::unixstream::open()\&. .SS "void ost::UnixStream::endStream (void)\fC [protected]\fP" .PP Used to terminate the buffer space and cleanup the socket connection\&. This fucntion is called by the destructor\&. .SS "int ost::UnixStream::getBufferSize (void) const\fC [inline]\fP" .PP Return the size of the current stream buffering used\&. .PP \fBReturns:\fP .RS 4 size of stream buffers\&. .RE .PP .SS "bool ost::UnixStream::isPending (\fBPending\fP pend, \fBtimeout_t\fP timeout = \fC\fBTIMEOUT_INF\fP\fP)\fC [virtual]\fP" .PP Get the status of pending stream data\&. This can be used to examine if input or output is waiting, or if an error or disconnect has occured on the stream\&. If a read buffer contains data then input is ready and if write buffer contains data it is first flushed and then checked\&. .PP Reimplemented from \fBost::Socket\fP\&. .SS "int ost::UnixStream::overflow (int ch)\fC [protected]\fP" .PP This streambuf method is used to write the output buffer through the established unix domain connection\&. .PP \fBParameters:\fP .RS 4 \fIch\fP char to push through\&. .RE .PP \fBReturns:\fP .RS 4 char pushed through\&. .RE .PP .SS "void ost::UnixStream::setTimeout (\fBtimeout_t\fP to)\fC [inline]\fP" .PP Set the I/O operation timeout for socket I/O operations\&. .PP \fBParameters:\fP .RS 4 \fIto\fP timeout to set\&. .RE .PP .PP References ost::Socket::isPending(), TIMEOUT_INF, and ost::UnixSocket::UnixStream\&. .SS "int ost::UnixStream::sync (void)" .PP Flushes the stream input and output buffers, writes pending output\&. .PP \fBReturns:\fP .RS 4 0 on success\&. .RE .PP .SS "int ost::UnixStream::uflow (void)\fC [protected]\fP" .PP This streambuf method is used for doing unbuffered reads through the established unix domain socket connection when in interactive mode\&. Also this method will handle proper use of buffers if not in interative mode\&. .PP \fBReturns:\fP .RS 4 char from unix domain socket connection, EOF if not connected\&. .RE .PP .SS "virtual int ost::UnixStream::underflow (void)\fC [protected]\fP, \fC [virtual]\fP" .PP This streambuf method is used to load the input buffer through the established unix domain socket connection\&. .PP \fBReturns:\fP .RS 4 char from get buffer, EOF if not connected\&. .RE .PP .SS "std::iostream* ost::UnixStream::unixstr (void)\fC [inline]\fP, \fC [protected]\fP" .PP Used in derived classes to refer to the current object via it's iostream\&. For example, to send a set of characters in a derived method, one might use *tcp() << 'test'\&. .PP \fBReturns:\fP .RS 4 stream pointer of this object\&. .RE .PP .PP References ost::UnixSocket::UnixStream\&. .SH "Member Data Documentation" .PP .SS "int ost::UnixStream::bufsize\fC [protected]\fP" .SS "char* ost::UnixStream::gbuf\fC [protected]\fP" .SS "char * ost::UnixStream::pbuf\fC [protected]\fP" .SS "\fBtimeout_t\fP ost::UnixStream::timeout\fC [protected]\fP" .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.