EpcTools
An event based multi-threaded C++ development framework.
|
A TCP socket class capabile of sending and receiving data. More...
#include <esocket.h>
Public Member Functions | |
Talker (Thread< TQueue, TMessage > &thread, Int bufsize=2097152) | |
Class constructor. More... | |
virtual | ~Talker () |
Class destrucor. More... | |
Address & | getLocal () |
Retrieves the local socket address. More... | |
EString | getLocalAddress () const |
Retrieves the IP address associated with the local socket. More... | |
UShort | getLocalPort () const |
Retrieves the port associated with the local socket. More... | |
Talker & | setLocal (cpStr addr, UShort port) |
Assigns the local socket address. More... | |
Talker & | setLocal (const Address &addr) |
Assigns the local socket address. More... | |
Address & | getRemote () |
Retrieves the remote socket address. More... | |
EString | getRemoteAddress () const |
Retrieves the IP address associated with the remote socket. More... | |
UShort | getRemotePort () const |
Retrieves the port associated with the remote socket. More... | |
Talker & | setRemote (cpStr addr, UShort port) |
Assigns the remote socket address. More... | |
Talker & | setRemote (const Address &addr) |
Assigns the remote socket address. More... | |
Void | connect () |
Initiates an IP connection with to the previously assigned remote socket address. More... | |
Void | connect (Address &addr) |
Initiates an IP connection. More... | |
Void | connect (cpStr addr, UShort port) |
Initiates an IP connection. More... | |
Int | bytesPending () |
Retrieves the number of bytes in the receive buffer. More... | |
Int | peek (pUChar dest, Int len) |
Rtrieves the specified number of bytes from the receive buffer without updating the read position. More... | |
Int | read (pUChar dest, Int len) |
Rtrieves the specified number of bytes from the receive buffer. More... | |
Void | write (pUChar src, Int len) |
Writes data to the socket. This is a thread safe method. More... | |
Bool | getSending () |
Retrieves indication if this socket is in the process of sending data. More... | |
SocketState | getState () |
Retrieves the connection state. More... | |
cpStr | getStateDescription () |
Retrieves the description of the current connection state. More... | |
Void | disconnect () |
Disconnects this socket. More... | |
virtual Void | onReceive () |
Called when data has been received. More... | |
virtual Void | onConnect () |
Called when a connection has been established. More... | |
virtual Void | onClose () |
Called when the socket has been closed. More... | |
virtual Void | onError () |
Called when an error is detected on the socket. More... | |
![]() | |
virtual | ~Base () |
Virtual class destructor. More... | |
Thread< TQueue, TMessage > & | getThread () |
Retrieves the socket thread that this socket is associated with. More... | |
SocketType | getSocketType () |
Retrieves the socket type. More... | |
Int | getFamily () |
Retrieves the address family. More... | |
Int | getType () |
Retrieves the socket type. More... | |
Int | getProtocol () |
Retrieves the protocol. More... | |
Int | getError () |
Retrieves the last error value. More... | |
Void | close () |
Closes this socket. More... | |
Int | getHandle () |
Retrieves the socket file handle. More... | |
cpStr | getStateDescription (SocketState state) |
Retrieves the description of the connection state. More... | |
Friends | |
class | Thread< TQueue, TMessage > |
A TCP socket class capabile of sending and receiving data.
|
inline |
Class constructor.
thread | the socket thread that this socket is associated with. |
bufsize | the size of the send and receive circular buffers. |
|
inlinevirtual |
Class destrucor.
|
inline |
Retrieves the number of bytes in the receive buffer.
|
inline |
Initiates an IP connection with to the previously assigned remote socket address.
|
inline |
Initiates an IP connection.
addr | the remote socket address. |
|
inline |
Initiates an IP connection.
addr | the remote socket IP address. |
port | the remote socket port. |
|
inlinevirtual |
Disconnects this socket.
Reimplemented from ESocket::Base< TQueue, TMessage >.
|
inline |
Retrieves the local socket address.
|
inline |
Retrieves the IP address associated with the local socket.
|
inline |
Retrieves the port associated with the local socket.
the port associated with the local socket.
|
inline |
Retrieves the remote socket address.
|
inline |
Retrieves the IP address associated with the remote socket.
|
inline |
Retrieves the port associated with the remote socket.
the port associated with the remote socket.
|
inline |
Retrieves indication if this socket is in the process of sending data.
|
inline |
Retrieves the connection state.
|
inline |
Retrieves the description of the current connection state.
|
inlinevirtual |
Called when the socket has been closed.
|
inlinevirtual |
Called when a connection has been established.
|
inlinevirtual |
Called when an error is detected on the socket.
|
inlinevirtual |
Called when data has been received.
|
inline |
Rtrieves the specified number of bytes from the receive buffer without updating the read position.
dest | the location to write the data read. |
len | the desired number of bytes to read. |
|
inline |
Rtrieves the specified number of bytes from the receive buffer.
dest | the location to write the data read. |
len | the desired number of bytes to read. |
|
inline |
Assigns the local socket address.
addr | the address object to copy. |
|
inline |
Assigns the local socket address.
addr | the IP address. |
port | the port. |
|
inline |
Assigns the remote socket address.
addr | the address object to copy. |
|
inline |
Assigns the remote socket address.
addr | the IP address. |
port | the port. |
|
inline |
Writes data to the socket. This is a thread safe method.
src | the location to the data to write. |
len | the desired number of bytes to write. |
|
friend |