activemq::network::TcpSocket Class Reference

#include <TcpSocket.h>

Inheritance diagram for activemq::network::TcpSocket:

activemq::network::Socket List of all members.

Public Member Functions

 TcpSocket ()
 TcpSocket (SocketHandle socketHandle)
virtual ~TcpSocket ()
SocketHandle getSocketHandle ()
virtual void connect (const char *host, const int port) throw ( SocketException )
virtual bool isConnected () const
virtual io::InputStreamgetInputStream ()
virtual io::OutputStreamgetOutputStream ()
virtual int getSoLinger () const throw ( SocketException )
virtual void setSoLinger (const int linger) throw ( SocketException )
virtual bool getKeepAlive () const throw ( SocketException )
virtual void setKeepAlive (const bool keepAlive) throw ( SocketException )
virtual int getReceiveBufferSize () const throw ( SocketException )
virtual void setReceiveBufferSize (const int size) throw ( SocketException )
virtual bool getReuseAddress () const throw ( SocketException )
virtual void setReuseAddress (const bool reuse) throw ( SocketException )
virtual int getSendBufferSize () const throw ( SocketException )
virtual void setSendBufferSize (const int size) throw ( SocketException )
virtual int getSoTimeout () const throw ( SocketException )
virtual void setSoTimeout (const int timeout) throw (SocketException)
virtual void close () throw ( cms::CMSException )

Static Protected Attributes

static StaticSocketInitializer staticSocketInitializer

Private Attributes

SocketHandle socketHandle
SocketInputStreaminputStream
SocketOutputStreamoutputStream

Classes

class  StaticSocketInitializer

Detailed Description

Platform-independent implementation of the socket interface.


Constructor & Destructor Documentation

TcpSocket::TcpSocket  ) 
 

Construct a non-connected socket.

TcpSocket::TcpSocket SocketHandle  socketHandle  ) 
 

Construct a connected or bound socket based on given socket handle.

Parameters:
socketHandle a socket handle to wrap in the object

TcpSocket::~TcpSocket  )  [virtual]
 

Destruct. Releases the socket handle but not gracefully shut down the connection.


Member Function Documentation

void TcpSocket::close  )  throw ( cms::CMSException ) [virtual]
 

Closes this object and deallocates the appropriate resources.

Exceptions:
CMSException 

void TcpSocket::connect const char *  host,
const int  port
throw ( SocketException ) [virtual]
 

Connects to the specified destination. Closes this socket if connected to another destination.

Parameters:
host The host of the server to connect to.
port The port of the server to connect to.
Exceptions:
IOException Thrown if a failure occurred in the connect.

Implements activemq::network::Socket.

InputStream * TcpSocket::getInputStream  )  [virtual]
 

Gets the InputStream for this socket.

Returns:
The InputStream for this socket. NULL if not connected.

Implements activemq::network::Socket.

bool TcpSocket::getKeepAlive  )  const throw ( SocketException ) [virtual]
 

Gets the keep alive flag.

Returns:
True if keep alive is enabled.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

OutputStream * TcpSocket::getOutputStream  )  [virtual]
 

Gets the OutputStream for this socket.

Returns:
the OutputStream for this socket. NULL if not connected.

Implements activemq::network::Socket.

int TcpSocket::getReceiveBufferSize  )  const throw ( SocketException ) [virtual]
 

Gets the receive buffer size.

Returns:
the receive buffer size in bytes.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

bool TcpSocket::getReuseAddress  )  const throw ( SocketException ) [virtual]
 

Gets the reuse address flag.

Returns:
True if the address can be reused.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

int TcpSocket::getSendBufferSize  )  const throw ( SocketException ) [virtual]
 

Gets the send buffer size.

Returns:
the size in bytes of the send buffer.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

SocketHandle activemq::network::TcpSocket::getSocketHandle  )  [inline]
 

Gets the handle for the socket.

Returns:
SocketHabler for this Socket, can be NULL

int TcpSocket::getSoLinger  )  const throw ( SocketException ) [virtual]
 

Gets the linger time.

Returns:
The linger time in seconds.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

int TcpSocket::getSoTimeout  )  const throw ( SocketException ) [virtual]
 

Gets the timeout for socket operations.

Returns:
The timeout in milliseconds for socket operations.
Exceptions:
SocketException Thrown if unable to retrieve the information.

Implements activemq::network::Socket.

virtual bool activemq::network::TcpSocket::isConnected  )  const [inline, virtual]
 

Indicates whether or not this socket is connected to a destination.

Returns:
true if connected

Implements activemq::network::Socket.

void TcpSocket::setKeepAlive const bool  keepAlive  )  throw ( SocketException ) [virtual]
 

Enables/disables the keep alive flag.

Parameters:
keepAlive If true, enables the flag.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

void TcpSocket::setReceiveBufferSize const int  size  )  throw ( SocketException ) [virtual]
 

Sets the recieve buffer size.

Parameters:
size Number of bytes to set the receive buffer to.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

void TcpSocket::setReuseAddress const bool  reuse  )  throw ( SocketException ) [virtual]
 

Sets the reuse address flag.

Parameters:
reuse If true, sets the flag.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

void TcpSocket::setSendBufferSize const int  size  )  throw ( SocketException ) [virtual]
 

Sets the send buffer size.

Parameters:
size The number of bytes to set the send buffer to.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

void TcpSocket::setSoLinger const int  linger  )  throw ( SocketException ) [virtual]
 

Sets the linger time.

Parameters:
linger The linger time in seconds. If 0, linger is off.
Exceptions:
SocketException if the operation fails.

Implements activemq::network::Socket.

void TcpSocket::setSoTimeout const int  timeout  )  throw (SocketException) [virtual]
 

Sets the timeout for socket operations.

Parameters:
timeout The timeout in milliseconds for socket operations.
Exceptions:
SocketException Thrown if unable to set the information.

Implements activemq::network::Socket.


Member Data Documentation

SocketInputStream* activemq::network::TcpSocket::inputStream [private]
 

The input stream for reading this socket.

SocketOutputStream* activemq::network::TcpSocket::outputStream [private]
 

The output stream for writing to this socket.

SocketHandle activemq::network::TcpSocket::socketHandle [private]
 

The handle for this socket.

TcpSocket::StaticSocketInitializer TcpSocket::staticSocketInitializer [static, protected]
 


The documentation for this class was generated from the following files:
Generated on Thu Aug 3 18:03:33 2006 for activemq-cpp by  doxygen 1.4.5