activemq-cpp-3.4.0
|
Acts as a base class for all physical Socket implementations. More...
#include <src/main/decaf/net/SocketImpl.h>
Public Member Functions | |
SocketImpl () | |
virtual | ~SocketImpl () |
virtual void | create ()=0 |
Creates the underlying platform Socket data structures which allows for Socket options to be applied. | |
virtual void | accept (SocketImpl *socket)=0 |
Accepts a new connection on the given Socket. | |
virtual void | connect (const std::string &hostname, int port, int timeout)=0 |
Connects this socket to the given host and port. | |
virtual void | bind (const std::string &ipaddress, int port)=0 |
Binds this Socket instance to the local ip address and port number given. | |
virtual void | listen (int backlog)=0 |
Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument. | |
virtual decaf::io::InputStream * | getInputStream ()=0 |
Gets the InputStream linked to this Socket. | |
virtual decaf::io::OutputStream * | getOutputStream ()=0 |
Gets the OutputStream linked to this Socket. | |
virtual int | available ()=0 |
Gets the number of bytes that can be read from the Socket without blocking. | |
virtual void | close ()=0 |
Closes the socket, terminating any blocked reads or writes. | |
virtual void | shutdownInput ()=0 |
Places the input stream for this socket at "end of stream". | |
virtual void | shutdownOutput ()=0 |
Disables the output stream for this socket. | |
virtual int | getOption (int option) const =0 |
Gets the specified Socket option. | |
virtual void | setOption (int option, int value)=0 |
Sets the specified option on the Socket if supported. | |
int | getPort () const |
Gets the port that this socket has been assigned. | |
int | getLocalPort () const |
Gets the value of this SocketImpl's local port field. | |
std::string | getInetAddress () const |
Gets the value of this SocketImpl's address field. | |
const decaf::io::FileDescriptor * | getFileDescriptor () const |
Gets the FileDescriptor for this Socket, the Object is owned by this Socket and should not be deleted by the caller. | |
virtual std::string | getLocalAddress () const =0 |
Gets the value of the local Inet address the Socket is bound to if bound, otherwise return the InetAddress ANY value "0.0.0.0". | |
std::string | toString () const |
Returns a string containing the address and port of this Socket instance. | |
virtual bool | supportsUrgentData () const |
virtual void | sendUrgentData (int data) |
Sends on byte of urgent data to the Socket. | |
Protected Attributes | |
int | port |
The remote port that this Socket is connected to. | |
int | localPort |
The port on the Local Machine that this Socket is Bound to. | |
std::string | address |
The Remote Address that the Socket is connected to. | |
io::FileDescriptor * | fd |
The File Descriptor for this Socket. |
Acts as a base class for all physical Socket implementations.
decaf::net::SocketImpl::SocketImpl | ( | ) |
virtual decaf::net::SocketImpl::~SocketImpl | ( | ) | [virtual] |
virtual void decaf::net::SocketImpl::accept | ( | SocketImpl * | socket | ) | [pure virtual] |
Accepts a new connection on the given Socket.
socket | The accepted connection. |
IOException | if an I/O error occurs while attempting this operation. |
SocketException | if an error occurs while performing an Accept on the socket. |
SocketTimeoutException | if the accept call times out due to SO_TIMEOUT being set. |
virtual int decaf::net::SocketImpl::available | ( | ) | [pure virtual] |
Gets the number of bytes that can be read from the Socket without blocking.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::bind | ( | const std::string & | ipaddress, |
int | port | ||
) | [pure virtual] |
Binds this Socket instance to the local ip address and port number given.
ipaddress | The address of local ip to bind to. |
port | The port number on the host to bind to. |
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::close | ( | ) | [pure virtual] |
Closes the socket, terminating any blocked reads or writes.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::connect | ( | const std::string & | hostname, |
int | port, | ||
int | timeout | ||
) | [pure virtual] |
Connects this socket to the given host and port.
hostname | The name of the host to connect to, or IP address. |
port | The port number on the host to connect to. |
timeout | Time in milliseconds to wait for a connection, 0 indicates forever. |
IOException | if an I/O error occurs while attempting this operation. |
SocketTimeoutException | if the connect call times out due to timeout being set. |
IllegalArguementException | if a parameter has an illegal value. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::create | ( | ) | [pure virtual] |
Creates the underlying platform Socket data structures which allows for Socket options to be applied.
The created socket is in an unconnected state.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
const decaf::io::FileDescriptor* decaf::net::SocketImpl::getFileDescriptor | ( | ) | const [inline] |
std::string decaf::net::SocketImpl::getInetAddress | ( | ) | const [inline] |
Gets the value of this SocketImpl's address field.
virtual decaf::io::InputStream* decaf::net::SocketImpl::getInputStream | ( | ) | [pure virtual] |
Gets the InputStream linked to this Socket.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual std::string decaf::net::SocketImpl::getLocalAddress | ( | ) | const [pure virtual] |
Gets the value of the local Inet address the Socket is bound to if bound, otherwise return the InetAddress ANY value "0.0.0.0".
Implemented in decaf::internal::net::tcp::TcpSocket.
int decaf::net::SocketImpl::getLocalPort | ( | ) | const [inline] |
Gets the value of this SocketImpl's local port field.
virtual int decaf::net::SocketImpl::getOption | ( | int | option | ) | const [pure virtual] |
Gets the specified Socket option.
option | The Socket options whose value is to be retrieved. |
IOException | if an I/O error occurs while performing this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual decaf::io::OutputStream* decaf::net::SocketImpl::getOutputStream | ( | ) | [pure virtual] |
Gets the OutputStream linked to this Socket.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
int decaf::net::SocketImpl::getPort | ( | ) | const [inline] |
Gets the port that this socket has been assigned.
virtual void decaf::net::SocketImpl::listen | ( | int | backlog | ) | [pure virtual] |
Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.
If a connection indication arrives when the queue is full, the connection is refused.
backlog | The maximum length of the connection queue. |
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::sendUrgentData | ( | int | data | ) | [virtual] |
Sends on byte of urgent data to the Socket.
data | The value to write as urgent data, only the lower eight bits are sent. |
IOException | if an I/O error occurs while performing this operation. |
virtual void decaf::net::SocketImpl::setOption | ( | int | option, |
int | value | ||
) | [pure virtual] |
Sets the specified option on the Socket if supported.
option | The Socket option to set. |
value | The value of the socket option to apply to the socket. |
IOException | if an I/O error occurs while performing this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::shutdownInput | ( | ) | [pure virtual] |
Places the input stream for this socket at "end of stream".
Any data sent to this socket is acknowledged and then silently discarded. If you read from a socket input stream after invoking shutdownInput() on the socket, the stream will return EOF.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual void decaf::net::SocketImpl::shutdownOutput | ( | ) | [pure virtual] |
Disables the output stream for this socket.
For a TCP socket, any previously written data will be sent followed by TCP's normal connection termination sequence. If you write to a socket output stream after invoking shutdownOutput() on the socket, the stream will throw an IOException.
IOException | if an I/O error occurs while attempting this operation. |
Implemented in decaf::internal::net::tcp::TcpSocket.
virtual bool decaf::net::SocketImpl::supportsUrgentData | ( | ) | const [inline, virtual] |
std::string decaf::net::SocketImpl::toString | ( | ) | const |
Returns a string containing the address and port of this Socket instance.
std::string decaf::net::SocketImpl::address [protected] |
The Remote Address that the Socket is connected to.
io::FileDescriptor* decaf::net::SocketImpl::fd [protected] |
The File Descriptor for this Socket.
int decaf::net::SocketImpl::localPort [protected] |
The port on the Local Machine that this Socket is Bound to.
int decaf::net::SocketImpl::port [protected] |
The remote port that this Socket is connected to.