|
skstream
|
A base class for stream buffers that handle sockets. More...
#include <skstream.h>
Public Member Functions | |
| socketbuf (SOCKET_TYPE sock, std::streamsize insize=0x8000, std::streamsize outsize=0x8000) | |
| socketbuf (SOCKET_TYPE sock, std::streambuf::char_type *buf, std::streamsize length) | |
| virtual | ~socketbuf () |
| Destroy the socket buffer. | |
| void | setSocket (SOCKET_TYPE sock) |
| Set the existing socket that this buffer should use. | |
| SOCKET_TYPE | getSocket () const |
| Get the socket that this buffer uses. | |
| void | setReadTimeout (unsigned sec, unsigned usec=0) |
| void | setWriteTimeout (unsigned sec, unsigned usec=0) |
| void | setTimeout (unsigned sec, unsigned usec=0) |
| bool | timeout () const |
| Return the flag indicating whether a timeout has occured. | |
Protected Member Functions | |
| virtual int_type | overflow (int_type nCh=traits_type::eof())=0 |
| Handle writing data from the buffer to the socket. | |
| virtual int_type | underflow ()=0 |
| Handle reading data from the socket to the buffer. | |
| virtual int | sync () |
| Flush the output buffer. | |
| std::streambuf * | setbuf (std::streambuf::char_type *buf, std::streamsize len) |
Protected Attributes | |
| SOCKET_TYPE | _socket |
| timeval | _underflow_timeout |
| timeval | _overflow_timeout |
| bool | Timeout |
Private Member Functions | |
| socketbuf (const socketbuf &) | |
| Not implemented. Copying a socket buffer is not permited. | |
| socketbuf & | operator= (const socketbuf &) |
| Not implemented. Copying a socket buffer is not permited. | |
Private Attributes | |
| std::streambuf::char_type * | _buffer |
A base class for stream buffers that handle sockets.
| socketbuf::socketbuf | ( | SOCKET_TYPE | sock, |
| std::streamsize | insize = 0x8000, |
||
| std::streamsize | outsize = 0x8000 |
||
| ) | [explicit] |
Make a new socket buffer from an existing socket, with optional buffer sizes.
References setbuf(), and setSocket().
| socketbuf::socketbuf | ( | SOCKET_TYPE | sock, |
| std::streambuf::char_type * | buf, | ||
| std::streamsize | length | ||
| ) |
Make a new socket buffer from an existing socket, with an existing buffer.
References setbuf(), and setSocket().
| std::streambuf * socketbuf::setbuf | ( | std::streambuf::char_type * | buf, |
| std::streamsize | len | ||
| ) | [protected] |
Set the buffer area this stream buffer uses. Only works if not already set.
Referenced by socketbuf().
| void socketbuf::setReadTimeout | ( | unsigned | sec, |
| unsigned | usec = 0 |
||
| ) | [inline] |
Set up a timeout value after which an error flag is set if the socket is not ready for a read.
| void socketbuf::setWriteTimeout | ( | unsigned | sec, |
| unsigned | usec = 0 |
||
| ) | [inline] |
Set up a timeout value after which an error flag is set if the socket is not ready for a write.
1.7.6.1