template<class _E, class _Tr = std::char_traits<_E> > class tcpsocket::basic_socstreambuf

Drop in replacement for basic_streambuf.

Child Classes

Drop in replacement for basic_streambuf. This template class derives from std::basic_streambuf to provide a stream buffer which reads to and from a tcpsocket::BufferedSocket.
Parameters:
_E - integer type
_Tr - Traits for _E

This class has no child classes.

Inheritance:


Public Fields

[more]typedef typename std::basic_streambuf<_E,_Tr>: :pos_type pos_type
basic_socstreambuf stream position type
[more]typedef typename std::basic_streambuf<_E,_Tr>: :off_type off_type
basic_socstreambuf stream offset type
[more]typedef typename std::basic_streambuf<_E,_Tr>: :int_type int_type
basic_socstreambuf integer type

Public Methods

[more]explicit basic_socstreambuf(const char* addr, short port, int bufSize=-1, std::ios_base::openmode _W = std::ios_base::in | std::ios_base::out) throw(SocketException)
Constructs a basic_socstreambuf from an address and port
[more]explicit basic_socstreambuf(int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out | std::ios::binary) throw(SocketException)
Constructs a basic_socstreambuf specifying the buffer size and buffer mode
[more]explicit basic_socstreambuf(const Socket& s, int bufSize=-1, std::ios_base::openmode _W = std::ios_base::in | std::ios_base::out) throw(SocketException)
Constructs a basic_socstreambuf from an already opened socket
[more]void close() throw(SocketException)
Closes the TCP/IP socket connection
[more]void getpeername(struct sockaddr_in* addr)
Obtains the address of the peer
[more]int getsocerror()
Provides the most recent socket error
[more]void open(const char* addr, short port) throw(SocketException)
Opens a TCP/IP connection to the endpoint
[more]virtual ~basic_socstreambuf()
Destroys the basic_socstreambuf, closes the socket if the socket was opened by the stream buffer

Member Documentation


typedef typename std::basic_streambuf<_E,_Tr> : :int_type int_type
basic_socstreambuf integer type


typedef typename std::basic_streambuf<_E,_Tr> : :pos_type pos_type
basic_socstreambuf stream position type


typedef typename std::basic_streambuf<_E,_Tr> : :off_type off_type
basic_socstreambuf stream offset type


explicit basic_socstreambuf (int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out | std::ios::binary) throw(SocketException)
Constructs a basic_socstreambuf specifying the buffer size and buffer mode
Parameters:
bufSize - [in,optional] The size of the buffer to be used, default uses a buffer the same size as a TCP socket buffer
_W - [in,optional] Specifies the mode of the buffer, default provides for read, write, in binary mode.


explicit basic_socstreambuf (const Socket& s, int bufSize=-1, std::ios_base::openmode _W = std::ios_base::in | std::ios_base::out) throw(SocketException)
Constructs a basic_socstreambuf from an already opened socket
Throws:
SocketException thrown if an error occurs
Parameters:
s - [in] An already opened socket
bufSize - [in,optional] The size of the buffer to be used, default uses a buffer the same size as a TCP socket buffer
_W - [in,optional] Specifies the mode of the buffer, default provides for read, write, in binary mode.


explicit basic_socstreambuf (const char* addr, short port, int bufSize=-1, std::ios_base::openmode _W = std::ios_base::in | std::ios_base::out) throw(SocketException)
Constructs a basic_socstreambuf from an address and port
Throws:
SocketException thrown if an error occurs connecting.
Parameters:
addr - [in] can be a TCP/IP address or DSN name
- port [in] The TCP/IP port to connect to
bufSize - [in,optional] The size of the buffer to be used, default uses a buffer the same size as a TCP socket buffer
_W - [in,optional] Specifies the mode of the buffer, default provides for read, write, in binary mode.


virtual ~basic_socstreambuf ()
Destroys the basic_socstreambuf, closes the socket if the socket was opened by the stream buffer


void open (const char* addr, short port) throw(SocketException)
Opens a TCP/IP connection to the endpoint
Throws:
SocketException thrown if an error occurs connecting.
Parameters:
addr - [in] can be a TCP/IP address or DSN name
- port [in] The TCP/IP port to connect to


void close () throw(SocketException)
Closes the TCP/IP socket connection
Throws:
SocketException thrown if an error occurs


int getsocerror ()
Provides the most recent socket error


void getpeername (struct sockaddr_in* addr)
Obtains the address of the peer

Table of Contents HTML hierarchy of classes or Java


Safmq Documentation, copyright (c) 2004-2010 Matthew J. Battey, Licensed Under Apache License Ver 2.0
Powered By: Get SAFMQ: Store and Forward Message Queue at SourceForge.net. Fast, secure and Free Open Source software downloads