#include <socket.h>
Inheritance diagram for TCPStream::
Public Methods | |
TCPStream (TCPSocket &server, int size=512, bool throwflag=true, timeout_t timeout=0) | |
Create a TCP stream by accepting a connection from a bound TCP socket acting as a server. More... | |
TCPStream (const InetHostAddress &host, tpport_t port, int size=512, bool throwflag=true, timeout_t to=0) | |
Create a TCP stream by connecting to a TCP socket (on a remote machine). More... | |
void | setTimeout (timeout_t to) |
Set the I/O operation timeout for socket I/O operations. More... | |
TCPStream (const TCPStream &source) | |
A copy constructor creates a new stream buffer. More... | |
virtual | ~TCPStream () |
Flush and empty all buffers, and then remove the allocated buffers. More... | |
int | sync (void) |
Flushes the stream input and output buffers, writes pending output. More... | |
bool | isPending (sockpend_t pend, timeout_t timeout=TIMEOUT_INF) |
Get the status of pending stream data. More... | |
int | getBufferSize (void) const |
Return the size of the current stream buffering used. More... | |
Protected Methods | |
TCPStream (bool throwflag=true) | |
The constructor required for "tcpstream", a more C++ style version of the TCPStream class. More... | |
void | Allocate (int size) |
Used to allocate the buffer space needed for iostream operations. More... | |
void | endStream (void) |
Used to terminate the buffer space and cleanup the socket connection. More... | |
virtual int | underflow (void) |
This streambuf method is used to load the input buffer through the established tcp socket connection. More... | |
int | uflow (void) |
This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode. More... | |
int | overflow (int ch) |
This streambuf method is used to write the output buffer through the established tcp connection. More... | |
void | Connect (const InetHostAddress &host, tpport_t port, int size) |
Create a TCP stream by connecting to a TCP socket (on a remote machine). More... | |
std::iostream * | tcp (void) |
Used in derived classes to refer to the current object via it's iostream. More... | |
Protected Attributes | |
timeout_t | timeout |
int | bufsize |
char * | gbuf |
char * | pbuf |
Friends | |
TCPStream & | crlf (TCPStream &) |
TCPStream & | lfcr (TCPStream &) |
The TCP stream is a C++ "stream" class, and can accept streaming of data to and from other C++ objects using the << and >> operators.
TCPStream itself can be formed either by connecting to a bound network address of a TCP server, or can be created when "accepting" a network connection from a TCP server.
|
The constructor required for "tcpstream", a more C++ style version of the TCPStream class.
|
|
Create a TCP stream by accepting a connection from a bound TCP socket acting as a server. This performs an "accept" call.
|
|
Create a TCP stream by connecting to a TCP socket (on a remote machine).
|
|
A copy constructor creates a new stream buffer.
|
|
Flush and empty all buffers, and then remove the allocated buffers.
|
|
Used to allocate the buffer space needed for iostream operations. This function is called by the constructor.
|
|
Create a TCP stream by connecting to a TCP socket (on a remote machine).
|
|
Used to terminate the buffer space and cleanup the socket connection. This fucntion is called by the destructor. |
|
Return the size of the current stream buffering used.
|
|
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. Reimplemented from Socket. |
|
This streambuf method is used to write the output buffer through the established tcp connection.
|
|
Set the I/O operation timeout for socket I/O operations.
Reimplemented in URLStream. |
|
Flushes the stream input and output buffers, writes pending output.
|
|
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".
|
|
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.
|
|
This streambuf method is used to load the input buffer through the established tcp socket connection.
Reimplemented in URLStream. |
|
|
|
|
|
|
|
|
|
|
|
|