#include <udpclient.h>
Public Member Functions | |
| UDPClient () | |
| virtual | ~UDPClient () |
| void | send (const UDPPacket &packet) |
| void | send (UDPPacket &&packet) |
Public Member Functions inherited from UDPAdapter | |
| UDPAdapter () | |
| virtual | ~UDPAdapter () |
| virtual bool | init (utility::ErrorState &errorState) override final |
| virtual void | onDestroy () override final |
| virtual bool | start (utility::ErrorState &errorState) override final |
| virtual void | stop () override final |
Public Member Functions inherited from Resource | |
| Resource () | |
Public Member Functions inherited from Object | |
| Object () | |
| virtual | ~Object () |
| Object (Object &)=delete | |
| Object & | operator= (const Object &)=delete |
| Object (Object &&)=delete | |
| Object & | operator= (Object &&)=delete |
Public Attributes | |
| int | mPort = 13251 |
| Property: 'Port' the port the client socket binds to. More... | |
| std::string | mEndpoint = "10.8.0.3" |
| Property: 'Endpoint' the ip address the client socket binds to. More... | |
| int | mMaxPacketQueueSize = 1000 |
| Property: 'MaxQueueSize' maximum of queued packets. More... | |
| bool | mStopOnMaxQueueSizeExceeded = true |
| Property: 'StopOnMaxQueueSizeExceeded' stop adding packets when queue size is exceed. More... | |
| bool | mBroadcast = false |
| Property: 'Broadcast' set option to broadcast. More... | |
Public Attributes inherited from UDPAdapter | |
| ResourcePtr< UDPThread > | mThread |
| Property: 'Thread' the udp thread the adapter registers itself to. More... | |
| bool | mAllowFailure = false |
| Property: 'AllowFailure' if binding to socket is allowed to fail on initialization. More... | |
Public Attributes inherited from Object | |
| std::string | mID |
| Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Protected Member Functions | |
| bool | onStart (utility::ErrorState &errorState) override final |
| void | onStop () override final |
| void | onProcess () override final |
Protected Member Functions inherited from UDPAdapter | |
| void | process () |
| bool | handleAsioError (const std::error_code &errorCode, utility::ErrorState &errorState, bool &success) |
| asio::io_context & | getIOContext () |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
| static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
The UDP Client class is used to send UDP Packets to an endpoint.
| UDPClient | ( | ) |
Constructor
|
virtual |
Destructor
|
finaloverrideprotectedvirtual |
The process function
Implements UDPAdapter.
|
finaloverrideprotectedvirtual |
Starts the UDP client and creates the socket
| errorState | contains error information |
Implements UDPAdapter.
|
finaloverrideprotectedvirtual |
Called when socket needs to be closed
Implements UDPAdapter.
| void send | ( | const UDPPacket & | packet | ) |
Makes a copy of the packet and queues if for sending. Call send(std::move(packet)) if you want to move the packet instead. Calling this method is Thread-Safe.
| packet | to send |
| void send | ( | UDPPacket && | packet | ) |
Moves and queues the packet for sending. Calling this method is Thread-Safe.
| packet | to send |
| bool mBroadcast = false |
Property: 'Broadcast' set option to broadcast.
| std::string mEndpoint = "10.8.0.3" |
Property: 'Endpoint' the ip address the client socket binds to.
| int mMaxPacketQueueSize = 1000 |
Property: 'MaxQueueSize' maximum of queued packets.
| int mPort = 13251 |
Property: 'Port' the port the client socket binds to.
| bool mStopOnMaxQueueSizeExceeded = true |
Property: 'StopOnMaxQueueSizeExceeded' stop adding packets when queue size is exceed.