activemq-cpp-3.6.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. | |
![]() | |
virtual | ~SocketOptions () |
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. |
Additional Inherited Members | |
![]() | |
static const int | SOCKET_OPTION_TCP_NODELAY |
Disable Nagle's algorithm for this connection. | |
static const int | SOCKET_OPTION_BINDADDR |
Fetch the local address binding of a socket (this option cannot be "set" only "gotten", since sockets are bound at creation time, and so the locally bound address cannot be changed). | |
static const int | SOCKET_OPTION_REUSEADDR |
Sets SO_REUSEADDR for a socket. | |
static const int | SOCKET_OPTION_BROADCAST |
Sets SO_BROADCAST for a socket. | |
static const int | SOCKET_OPTION_IP_MULTICAST_IF |
Set which outgoing interface on which to send multicast packets. | |
static const int | SOCKET_OPTION_IP_MULTICAST_IF2 |
Same as above. | |
static const int | SOCKET_OPTION_IP_MULTICAST_LOOP |
This option enables or disables local loopback of multicast datagrams. | |
static const int | SOCKET_OPTION_IP_TOS |
This option sets the type-of-service or traffic class field in the IP header for a TCP or UDP socket. | |
static const int | SOCKET_OPTION_LINGER |
Specify a linger-on-close timeout. | |
static const int | SOCKET_OPTION_TIMEOUT |
Set a timeout on blocking Socket operations. | |
static const int | SOCKET_OPTION_SNDBUF |
Set a hint the size of the underlying buffers used by the platform for outgoing network I/O. | |
static const int | SOCKET_OPTION_RCVBUF |
Set a hint the size of the underlying buffers used by the platform for incoming network I/O. | |
static const int | SOCKET_OPTION_KEEPALIVE |
When the keepalive option is set for a TCP socket and no data has been exchanged across the socket in either direction for 2 hours (NOTE: the actual value is implementation dependent), TCP automatically sends a keepalive probe to the peer. | |
static const int | SOCKET_OPTION_OOBINLINE |
When the OOBINLINE option is set, any TCP urgent data received on the socket will be received through the socket input stream. |
Acts as a base class for all physical Socket implementations.
decaf::net::SocketImpl::SocketImpl | ( | ) |
|
virtual |
|
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. |
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
|
inline |
Gets the value of this SocketImpl's address field.
|
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.
|
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.
|
inline |
Gets the value of this SocketImpl's local port field.
|
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.
|
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.
|
inline |
Gets the port that this socket has been assigned.
|
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 |
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. |
|
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.
|
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.
|
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.
|
inlinevirtual |
std::string decaf::net::SocketImpl::toString | ( | ) | const |
Returns a string containing the address and port of this Socket instance.
|
protected |
The Remote Address that the Socket is connected to.
|
protected |
The File Descriptor for this Socket.
|
protected |
The port on the Local Machine that this Socket is Bound to.
|
protected |
The remote port that this Socket is connected to.