Interface class for UDP service.
More...
#include <UDPService.hxx>
|
virtual size_t | sendData (const uint8_t *data, uint32_t bufferLength, const std::string &targetIP, uint16_t targetPort, std::optional< uint16_t > sourcePort=std::nullopt)=0 |
| Sends data over UDP.
|
|
Interface class for UDP service.
The UDPService class provides an interface for sending and receiving data over UDP. It is designed to be extended by concrete implementations that handle the specifics of UDP communication.
Definition at line 19 of file UDPService.hxx.
◆ getInstance()
static std::shared_ptr< UDPService > UDPService::getInstance |
( |
const std::string & |
name | ) |
|
|
static |
Gets the singleton instance of UDPService.
- Parameters
-
name | The name of the service instance. |
- Returns
- A shared pointer to the UDPService instance.
◆ sendData()
virtual size_t UDPService::sendData |
( |
const uint8_t * |
data, |
|
|
uint32_t |
bufferLength, |
|
|
const std::string & |
targetIP, |
|
|
uint16_t |
targetPort, |
|
|
std::optional< uint16_t > |
sourcePort = std::nullopt |
|
) |
| |
|
pure virtual |
Sends data over UDP.
- Parameters
-
data | Pointer to the data to send. |
bufferLength | Length of the data buffer. |
targetIP | The target IP address. |
targetPort | The target port number. |
sourcePort | Optional source port number. If not specified, a random port is used. |
- Returns
- The number of bytes sent.
The documentation for this class was generated from the following file: