|
ucommon
|
Streamable tcp connection between client and server. More...
#include <stream.h>


Public Member Functions | |
| void | close (void) |
| Close an active stream connection. | |
| void | open (Socket::address &address, unsigned segment=536) |
| Open a stream connection to a tcp service. | |
| void | open (char *host, char *service, unsigned segment=536) |
| Open a stream connectoion to a host and service. | |
| operator bool () | |
| See if stream connection is active. | |
| bool | operator! () |
| See if stream is disconnected. | |
| tcpstream (tcpstream ©) | |
| Copy constructor... | |
| tcpstream (TCPServer *server, unsigned segsize=536, timeout_t timeout=0) | |
| Create a stream from an existing tcp listener. | |
| tcpstream (int family=2, timeout_t timeout=0) | |
| Create an unconnected tcp stream object that is idle until opened. | |
| tcpstream (Socket::address &address, unsigned segsize=536, timeout_t timeout=0) | |
| A convenience constructor that creates a connected tcp stream directly from an address. | |
| virtual | ~tcpstream () |
| Destroy a tcp stream. | |
Protected Member Functions | |
| int | _getch (void) |
| This streambuf method is used to load the input buffer through the established tcp socket connection. | |
| int | _putch (int ch) |
| This streambuf method is used to write the output buffer through the established tcp connection. | |
| virtual ssize_t | _read (char *buffer, size_t size) |
| virtual bool | _wait (void) |
| virtual ssize_t | _write (char *buffer, size_t size) |
| socket_t | getsocket (void) |
| void | release (void) |
| Release the tcp stream and destroy the underlying socket. | |
Protected Attributes | |
| socket_t | so |
| timeout_t | timeout |
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.
| ucommon::tcpstream::tcpstream | ( | tcpstream & | copy | ) |
Copy constructor...
| copy | for object. |
| ucommon::tcpstream::tcpstream | ( | TCPServer * | server, |
| unsigned | segsize = 536, |
||
| timeout_t | timeout = 0 |
||
| ) |
Create a stream from an existing tcp listener.
| server | to accept connection from. |
| segsize | for tcp segments and buffering. |
| timeout | for socket i/o operations. |
| ucommon::tcpstream::tcpstream | ( | int | family = 2, |
| timeout_t | timeout = 0 |
||
| ) |
Create an unconnected tcp stream object that is idle until opened.
| family | of protocol to create. |
| timeout | for socket i/o operations. |
| ucommon::tcpstream::tcpstream | ( | Socket::address & | address, |
| unsigned | segsize = 536, |
||
| timeout_t | timeout = 0 |
||
| ) |
A convenience constructor that creates a connected tcp stream directly from an address.
The socket is constructed to match the type of the the address family in the socket address that is passed.
| address | of service to connect to. |
| segsize | for tcp segments and buffering. |
| timeout | for socket i/o operations. |
| int ucommon::tcpstream::_getch | ( | void | ) | [protected, virtual] |
This streambuf method is used to load the input buffer through the established tcp socket connection.
Implements ucommon::CharacterProtocol.
| int ucommon::tcpstream::_putch | ( | int | ch | ) | [protected, virtual] |
This streambuf method is used to write the output buffer through the established tcp connection.
| ch | char to push through. |
Implements ucommon::CharacterProtocol.
| void ucommon::tcpstream::close | ( | void | ) |
Close an active stream connection.
This does not release the socket but is a disconnect.
Reimplemented in ucommon::sstream.
| void ucommon::tcpstream::open | ( | Socket::address & | address, |
| unsigned | segment = 536 |
||
| ) |
Open a stream connection to a tcp service.
| address | of service to access. |
| segment | buffering size to use. |
| void ucommon::tcpstream::open | ( | char * | host, |
| char * | service, | ||
| unsigned | segment = 536 |
||
| ) |
Open a stream connectoion to a host and service.
| host | to connect to. |
| service | to connect to by name or number as string. |
| segment | buffering size to use. |
| ucommon::tcpstream::operator bool | ( | ) | [inline] |
See if stream connection is active.
Reimplemented from ucommon::StreamProtocol.
| bool ucommon::tcpstream::operator! | ( | ) | [inline] |
See if stream is disconnected.
Reimplemented from ucommon::StreamProtocol.
1.7.6.1