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

Drop in replacement for a basic_iostream.

Child Classes

Drop in replacement for a basic_iostream. This class implements it's stream buffer as a basic_socstreambuf to allow for TCP/IP stream communications.
Parameters:
_E - integer type
_Tr - Traits for _E

This class has no child classes.

Inheritance:


Public Methods

[more]explicit basic_socstream(const Socket& soc, int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out) throw(SocketException)
Constructs a basic_socstream from an already opened socket
[more]explicit basic_socstream(int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out | std::ios::binary)
Constructs a basic_socstream specifying the buffer size and buffer mode
[more]explicit basic_socstream(const char* addr, short port, int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out) throw(SocketException)
Constructs a basic_socstream from an address and port
[more]void close() throw(SocketException)
Closes the TCP/IP socket connection
[more]void getpeername(struct sockaddr_in* addr)
Provides 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]basic_socstreambuf<_E, _Tr> * rdbuf() const
Provides access to the stream buffer
[more]virtual ~basic_socstream()
Destroys the basic_socstream

Member Documentation


explicit basic_socstream (int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out | std::ios::binary)
Constructs a basic_socstream 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_socstream (const char* addr, short port, int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out) throw(SocketException)
Constructs a basic_socstream 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.


explicit basic_socstream (const Socket& soc, int bufSize=-1, std::ios_base::openmode _W = std::ios::in | std::ios::out) throw(SocketException)
Constructs a basic_socstream 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.


virtual ~basic_socstream ()
Destroys the basic_socstream


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


basic_socstreambuf<_E, _Tr> * rdbuf () const
Provides access to the stream buffer


void getpeername (struct sockaddr_in* addr)
Provides 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