IoT::UDP

class UDPEndpoint

File Information

Library: IoT/UDP
Package: UDPEndpoint
Header: IoT/UDP/UDPEndpoint.h

Description

The UDPEndpoint is used to receive and send UDP packets.

Inheritance

Known Derived Classes: UDPEndpointImpl

Member Summary

Member Functions: address, remoteAddress, sendPacket

Types Aliases

Ptr

using Ptr = Poco::SharedPtr < UDPEndpoint >;

Constructors

UDPEndpoint

UDPEndpoint();

Creates the UDPEndpoint.

Destructor

~UDPEndpoint virtual

virtual ~UDPEndpoint();

Destroys the UDPEndpoint.

Member Functions

address virtual

virtual EndpointAddress address() const = 0;

Returns the local address the socket of the endpoint has been bound to.

remoteAddress virtual

virtual Poco::Nullable < EndpointAddress > remoteAddress() const = 0;

Returns the remote address the socket of the endpoint is "connected" to, or null if the socket is not connected.

If a remote address has been specified in the configuration, packets can only be sent to that address and furthermore, only packets sent from the remote address are accepted.

Note that UDP sockets are not actually connected, the remote address merely acts as the default destination address for sendPacket().

sendPacket virtual

virtual void sendPacket(
    const std::vector < char > & payload,
    const EndpointAddress & destination = EndpointAddress ()
) = 0;

Sends the given payload to the given destination address, or to the remote address, if one has been configured.

If the endpoint has been connected to a remote address, the destination address must be omitted.

Variables

packetReceived

Poco::BasicEvent < const Packet > packetReceived;

Fired when an UDP packet has been received.

Securely control IoT edge devices from anywhere   Connect a Device