|
Ocean
|
This class is the base class for all packaged connectionless clients. More...
#include <PackagedConnectionlessClient.h>
Public Member Functions | |
| SocketResult | send (const Address4 &address, const Port &port, const void *data, const size_t size) |
| Sends data to a specified recipient. | |
| SocketResult | send (const Address4 &address, const Port &port, const std::string &message) |
| Sends a message to a specified recipient. | |
| size_t | maximalPackageSize () const |
| Returns the maximal size of a single package for this client. | |
Public Member Functions inherited from Ocean::Network::Socket | |
| virtual | ~Socket () |
| Destructs a socket object. | |
| SocketId | id () const |
| Returns the socket id. | |
| Address4 | address () const |
| Returns the own address of this socket. | |
| Port | port () const |
| Returns the own port of this socket. | |
| virtual bool | setAddress (const Address4 &address) |
| Sets the own address of this socket. | |
| virtual bool | setPort (const Port &port) |
| Sets the own port of this socket. | |
| operator bool () const | |
| Returns whether this socket is valid. | |
Protected Member Functions | |
| PackagedConnectionlessClient () | |
| Creates a new packaged connectionless client object. | |
| ~PackagedConnectionlessClient () override | |
| Destructs a packaged connectionless client object. | |
Protected Member Functions inherited from Ocean::Network::Client | |
| Client () | |
| Creates a new client. | |
| ~Client () override | |
| Destructs a client. | |
Protected Member Functions inherited from Ocean::Network::Socket | |
| Socket () | |
| Creates a new socket object. | |
| Socket (const Socket &object)=delete | |
| Disabled copy constructor. | |
| bool | setBlockingMode (const bool blocking) |
| Sets the blocking mode of this socket. | |
| size_t | maximalMessageSize (const size_t defaultSize=65536) |
| Returns the maximal message size in bytes. | |
| bool | releaseSocket () |
| Releases the socket. | |
| virtual bool | onScheduler () |
| The scheduler event function. | |
| Socket & | operator= (const Socket &object)=delete |
| Disabled copy operator. | |
Protected Member Functions inherited from Ocean::Network::PackagedSocket | |
| PackagedSocket () | |
| Creates a new packaged socket. | |
Protected Attributes | |
| MessageId | messageCounter_ = 0u |
| Client message counter. | |
| size_t | maximalPackageSize_ = 0 |
| Maximal package size of this connectionless socket (including the header). | |
| Buffer | clientPackageBuffer_ |
| Intermediate buffer storing individual parts of a large message. | |
Protected Attributes inherited from Ocean::Network::Client | |
| Buffer | socketBuffer_ |
| The socket buffer of this client. | |
Protected Attributes inherited from Ocean::Network::Socket | |
| SocketId | socketId_ = invalidSocketId() |
| Socket id. | |
| Lock | lock_ |
| Socket lock. | |
| NetworkResource | networkResource_ |
| The network resource object. | |
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... | |
| using | SocketId = SOCKET |
| Definition of a socket id. | |
| using | SocketId = int |
| Definition of a socket id. | |
| using | Buffer = std::vector< uint8_t > |
| Definition of a vector holding 8 bit values. | |
Public Types inherited from Ocean::Network::PackagedSocket | |
| using | MessageId = uint32_t |
| Definition of a message id. | |
Static Public Member Functions inherited from Ocean::Network::Socket | |
| static constexpr SocketId | invalidSocketId () |
| Returns an invalid socket id. | |
| static bool | setBlockingMode (const SocketId socketId, const bool blocking) |
| Sets the blocking mode of a socket. | |
Static Public Member Functions inherited from Ocean::Network::PackagedSocket | |
| static constexpr MessageId | invalidMessageId () |
| Returns an invalid message id. | |
| static constexpr size_t | packageManagmentHeaderSize () |
| Returns the size of the package management header in bytes. | |
| static constexpr size_t | maximalPackagedMessageSize () |
| Returns the maximal size of a packaged message. | |
Protected Types inherited from Ocean::Network::PackagedSocket | |
| using | MemoryBlockQueue = std::queue< MemoryBlock > |
| Definition of a queue holding memory blocks. | |
Static Protected Member Functions inherited from Ocean::Network::PackagedSocket | |
| static bool | extractNextPackage (MemoryBlockQueue &sourceQueue, MemoryBlock &targetMemory) |
| Extracts a memory block from a queue with memory block. | |
This class is the base class for all packaged connectionless clients.
|
protected |
Creates a new packaged connectionless client object.
|
overrideprotected |
Destructs a packaged connectionless client object.
|
inline |
Returns the maximal size of a single package for this client.
|
inline |
Sends a message to a specified recipient.
| address | Recipient address |
| port | Recipient port |
| message | The message to send, must be valid |
| SocketResult Ocean::Network::PackagedConnectionlessClient::send | ( | const Address4 & | address, |
| const Port & | port, | ||
| const void * | data, | ||
| const size_t | size | ||
| ) |
Sends data to a specified recipient.
| address | Recipient address |
| port | Recipient port |
| data | The data to send, can be nullptr if 'size == 0' |
| size | The size of the data to send in bytes, with range [0, infinity) |
|
protected |
Intermediate buffer storing individual parts of a large message.
|
protected |
Maximal package size of this connectionless socket (including the header).
|
protected |
Client message counter.