Ocean
|
This class implements a UDP client. More...
Public Member Functions | |
UDPClient () | |
Creates a new UDP client object. More... | |
~UDPClient () override | |
Destructs a UDP client object. More... | |
Public Member Functions inherited from Ocean::Network::ConnectionlessClient | |
SocketResult | send (const Address4 &address, const Port &port, const void *data, const size_t size) |
Sends data to a specified recipient. More... | |
SocketResult | send (const Address4 &address, const Port &port, const std::string &message) |
Sends a message to a specified recipient. More... | |
Public Member Functions inherited from Ocean::Network::Socket | |
virtual | ~Socket () |
Destructs a socket object. More... | |
SocketId | id () const |
Returns the socket id. More... | |
Address4 | address () const |
Returns the own address of this socket. More... | |
Port | port () const |
Returns the own port of this socket. More... | |
virtual bool | setAddress (const Address4 &address) |
Sets the own address of this socket. More... | |
virtual bool | setPort (const Port &port) |
Sets the own port of this socket. More... | |
operator bool () const | |
Returns whether this socket is valid. More... | |
Protected Member Functions | |
bool | buildSocket (const Address4 &localAddress=Address4(), const Port localPort=Port()) |
Build the UDP socket. More... | |
Protected Member Functions inherited from Ocean::Network::ConnectionlessClient | |
ConnectionlessClient () | |
Creates a new connectionless client object. More... | |
Protected Member Functions inherited from Ocean::Network::Client | |
Client () | |
Creates a new client. More... | |
~Client () override | |
Destructs a client. More... | |
Protected Member Functions inherited from Ocean::Network::Socket | |
Socket () | |
Creates a new socket object. More... | |
Socket (const Socket &object)=delete | |
Disabled copy constructor. More... | |
bool | setBlockingMode (const bool blocking) |
Sets the blocking mode of this socket. More... | |
size_t | maximalMessageSize (const size_t defaultSize=65536) |
Returns the maximal message size in bytes. More... | |
bool | releaseSocket () |
Releases the socket. More... | |
virtual bool | onScheduler () |
The scheduler event function. More... | |
Socket & | operator= (const Socket &object)=delete |
Disabled copy operator. More... | |
Additional Inherited Members | |
Public Types inherited from Ocean::Network::Socket | |
enum | SocketResult { SR_SUCCEEDED = 0 , SR_FAILED , SR_BUSY , SR_NOT_CONNECTED } |
Definition of individual result values. More... | |
typedef SOCKET | SocketId |
Definition of a socket id. More... | |
typedef int | SocketId |
Definition of a socket id. More... | |
typedef std::vector< uint8_t > | Buffer |
Definition of a vector holding 8 bit values. More... | |
Static Public Member Functions inherited from Ocean::Network::Socket | |
static constexpr SocketId | invalidSocketId () |
Returns an invalid socket id. More... | |
static bool | setBlockingMode (const SocketId socketId, const bool blocking) |
Sets the blocking mode of a socket. More... | |
Protected Attributes inherited from Ocean::Network::Client | |
Buffer | socketBuffer_ |
The socket buffer of this client. More... | |
Protected Attributes inherited from Ocean::Network::Socket | |
SocketId | socketId_ = invalidSocketId() |
Socket id. More... | |
Lock | lock_ |
Socket lock. More... | |
NetworkResource | networkResource_ |
The network resource object. More... | |
This class implements a UDP client.
Ocean::Network::UDPClient::UDPClient | ( | ) |
Creates a new UDP client object.
|
override |
Destructs a UDP client object.
|
protected |
Build the UDP socket.
localAddress | The local address to which the socket will be bound, a default address to bound the socket to any local address |
localPort | The local port to which the socket will be bound, a default port to bound the socket to any free port |