EpcTools
An event based multi-threaded C++ development framework.
|
A UDP socket class capabile of sending and receiving data. More...
#include <esocket.h>
Public Member Functions | |
UDP (Thread< TQueue, TMessage > &thread, Int bufsize=2097152) | |
Class constructor. More... | |
UDP (Thread< TQueue, TMessage > &thread, UShort port, Int bufsize=2097152) | |
Class constructor. More... | |
UDP (Thread< TQueue, TMessage > &thread, cpStr ipaddr, UShort port, Int bufsize=2097152) | |
Class constructor. More... | |
UDP (Thread< TQueue, TMessage > &thread, Address &addr, Int bufsize=2097152) | |
Class constructor. More... | |
virtual | ~UDP () |
Class destructor. More... | |
Address | getLocal () |
Retrieves the local address for this socket. More... | |
EString | getLocalAddress () |
Retrieves the IP address for this socket. More... | |
UShort | getLocalPort () |
Retrieves the port for this socket. More... | |
UDP & | setLocal (cpStr addr, UShort port) |
Assigns the socket address for this socket. More... | |
UDP & | setLocal (const Address &addr) |
Assigns the socket address for this socket. More... | |
Void | write (const Address &to, pVoid src, Int len) |
Sends data to the specified recipient address. More... | |
Bool | getSending () |
Retrieves indication if this socket is in the process of sending data. More... | |
Void | bind (UShort port) |
Binds this socket to a local port and IPADDR_ANY. More... | |
Void | bind (cpStr ipaddr, UShort port) |
Binds this socket to a local address. More... | |
Void | bind (const Address &addr) |
Binds this socket to a local address. More... | |
Void | disconnect () |
Disconnects the socket. More... | |
virtual Void | onReceive (const Address &from, pVoid msg, Int len) |
Called for each message that is received. More... | |
virtual Void | onError () |
Called when an error is detected on this 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 UDP socket class capabile of sending and receiving data.
|
inline |
Class constructor.
thread | the socket thread the talking socket will be associated with. |
bufsize | the size of the send and receive circular buffers. |
|
inline |
Class constructor.
thread | the socket thread the talking socket will be associated with. |
port | the local port to listen on. |
bufsize | the size of the send and receive circular buffers. |
|
inline |
Class constructor.
thread | the socket thread the talking socket will be associated with. |
ipaddr | the local IP address to listen on. |
port | the local port to listen on. |
bufsize | the size of the send and receive circular buffers. |
|
inline |
Class constructor.
thread | the socket thread the talking socket will be associated with. |
addr | the local socket address to listen on. |
bufsize | the size of the send and receive circular buffers. |
|
inlinevirtual |
Class destructor.
|
inline |
Binds this socket to a local address.
addr | the local socket address. |
|
inline |
Binds this socket to a local address.
ipaddr | the IP address. |
port | the port. |
|
inline |
Binds this socket to a local port and IPADDR_ANY.
port | the port. |
|
inlinevirtual |
Disconnects the socket.
Reimplemented from ESocket::Base< TQueue, TMessage >.
|
inline |
Retrieves the local address for this socket.
|
inline |
Retrieves the IP address for this socket.
|
inline |
Retrieves the port for this socket.
|
inline |
Retrieves indication if this socket is in the process of sending data.
|
inlinevirtual |
Called when an error is detected on this socket.
|
inlinevirtual |
Called for each message that is received.
from | the socket address that the data was received from. |
msg | pointer to the received data. |
len | number of bytes received. |
|
inline |
Assigns the socket address for this socket.
addr | the socket address for this socket. |
|
inline |
Assigns the socket address for this socket.
addr | the IP address for this socket. |
port | the port for this socket. |
|
inline |
Sends data to the specified recipient address.
to | the address to send the data to. |
src | a pointer to the beginning of the data buffer to send. |
len | the number of bytes to send. |
|
friend |