Streamable tcp connection between client and server.
More...
#include <stream.h>
|
void | close (void) |
| Close an active stream connection. More...
|
|
void | open (Socket::address &address, unsigned segment=536) |
| Open a stream connection to a tcp service. More...
|
|
void | open (const char *host, const char *service, unsigned segment=536) |
| Open a stream connectoion to a host and service. More...
|
|
| operator bool () const |
| See if stream connection is active. More...
|
|
bool | operator! () const |
| See if stream is disconnected. More...
|
|
| tcpstream (const tcpstream ©) |
| Copy constructor... More...
|
|
| tcpstream (const TCPServer *server, unsigned segsize=536, timeout_t timeout=0) |
| Create a stream from an existing tcp listener. More...
|
|
| tcpstream (int family=2, timeout_t timeout=0) |
| Create an unconnected tcp stream object that is idle until opened. More...
|
|
| tcpstream (Socket::address &address, unsigned segsize=536, timeout_t timeout=0) |
| A convenience constructor that creates a connected tcp stream directly from an address. More...
|
|
virtual | ~tcpstream () |
| Destroy a tcp stream.
|
|
bool | is_open (void) const |
|
| operator bool () const |
|
bool | operator! () const |
|
int | sync (void) |
| Flush the stream input and output buffers, writes pending output. More...
|
|
|
virtual ssize_t | _read (char *buffer, size_t size) |
|
virtual bool | _wait (void) |
|
virtual ssize_t | _write (const char *buffer, size_t size) |
|
socket_t | getsocket (void) const |
|
int | overflow (int ch) |
| This streambuf method is used to write the output buffer through the established tcp connection. More...
|
|
void | release (void) |
| Release the tcp stream and destroy the underlying socket.
|
|
int | underflow (void) |
| This streambuf method is used to load the input buffer through the established tcp socket connection. More...
|
|
void | allocate (size_t size) |
|
void | release (void) |
|
int | uflow () |
| This streambuf method is used for doing unbuffered reads through the establish tcp socket connection when in interactive mode. More...
|
|
|
socket_t | so |
|
timeout_t | timeout |
|
size_t | bufsize |
|
char * | gbuf |
|
char * | pbuf |
|
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.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 114 of file stream.h.
◆ tcpstream() [1/4]
ucommon::tcpstream::tcpstream |
( |
const tcpstream & |
copy | ) |
|
Copy constructor...
- Parameters
-
◆ tcpstream() [2/4]
ucommon::tcpstream::tcpstream |
( |
const TCPServer * |
server, |
|
|
unsigned |
segsize = 536 , |
|
|
timeout_t |
timeout = 0 |
|
) |
| |
Create a stream from an existing tcp listener.
- Parameters
-
server | to accept connection from. |
segsize | for tcp segments and buffering. |
timeout | for socket i/o operations. |
◆ tcpstream() [3/4]
ucommon::tcpstream::tcpstream |
( |
int |
family = 2 , |
|
|
timeout_t |
timeout = 0 |
|
) |
| |
Create an unconnected tcp stream object that is idle until opened.
- Parameters
-
family | of protocol to create. |
timeout | for socket i/o operations. |
◆ tcpstream() [4/4]
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.
- Parameters
-
address | of service to connect to. |
segsize | for tcp segments and buffering. |
timeout | for socket i/o operations. |
◆ close()
void ucommon::tcpstream::close |
( |
void |
| ) |
|
Close an active stream connection.
This does not release the socket but is a disconnect.
◆ open() [1/2]
void ucommon::tcpstream::open |
( |
Socket::address & |
address, |
|
|
unsigned |
segment = 536 |
|
) |
| |
Open a stream connection to a tcp service.
- Parameters
-
address | of service to access. |
segment | buffering size to use. |
◆ open() [2/2]
void ucommon::tcpstream::open |
( |
const char * |
host, |
|
|
const char * |
service, |
|
|
unsigned |
segment = 536 |
|
) |
| |
Open a stream connectoion to a host and service.
- Parameters
-
host | to connect to. |
service | to connect to by name or number as string. |
segment | buffering size to use. |
◆ operator bool()
ucommon::tcpstream::operator bool |
( |
| ) |
const |
|
inline |
See if stream connection is active.
- Returns
- true if stream is active.
Definition at line 196 of file stream.h.
◆ operator!()
bool ucommon::tcpstream::operator! |
( |
| ) |
const |
|
inline |
See if stream is disconnected.
- Returns
- true if stream disconnected.
Definition at line 204 of file stream.h.
◆ overflow()
int ucommon::tcpstream::overflow |
( |
int |
ch | ) |
|
|
protected |
This streambuf method is used to write the output buffer through the established tcp connection.
- Parameters
-
- Returns
- char pushed through.
◆ underflow()
int ucommon::tcpstream::underflow |
( |
void |
| ) |
|
|
protected |
This streambuf method is used to load the input buffer through the established tcp socket connection.
- Returns
- char from get buffer, EOF if not connected.
The documentation for this class was generated from the following file: