Struct coap::server::UdpCoapListener
source · pub struct UdpCoapListener { /* private fields */ }
Expand description
listener for a UDP socket
Implementations§
source§impl UdpCoapListener
impl UdpCoapListener
A listener for UDP packets. This listener can also subscribe to multicast addresses
pub fn new<A: ToSocketAddrs>(addr: A) -> Result<Self, Error>
pub fn from_socket(socket: UdpSocket) -> Self
sourcepub fn join_multicast(&mut self, addr: IpAddr)
pub fn join_multicast(&mut self, addr: IpAddr)
join multicast - adds the multicast addresses to the unicast listener
- IPv4 multicast address range is ‘224.0.0.0/4’
- IPv6 AllCoAp multicast addresses are ‘ff00::/8’
Parameter segment is used with IPv6 to determine the first octet.
- It’s value can be between 0x0 and 0xf.
- To join multiple segments, you have to call enable_discovery for each of the segments.
Some Multicast address scope IPv6 IPv4 equivalent[16] Scope Purpose ffx1::/16 127.0.0.0/8 Interface-local Packets with this destination address may not be sent over any network link, but must remain within the current node; this is the multicast equivalent of the unicast loopback address. ffx2::/16 224.0.0.0/24 Link-local Packets with this destination address may not be routed anywhere. ffx3::/16 239.255.0.0/16 IPv4 local scope ffx4::/16 Admin-local The smallest scope that must be administratively configured. ffx5::/16 Site-local Restricted to the local physical network. ffx8::/16 239.192.0.0/14 Organization-local Restricted to networks used by the organization administering the local network. (For example, these addresses might be used over VPNs; when packets for this group are routed over the public internet (where these addresses are not valid), they would have to be encapsulated in some other protocol.) ffxe::/16 224.0.1.0-238.255.255.255 Global scope Eligible to be routed over the public internet.
Notable addresses: ff02::1 All nodes on the local network segment ff0x::c Simple Service Discovery Protocol ff0x::fb Multicast DNS ff0x::fb Multicast CoAP ff0x::114 Used for experiments
sourcepub fn leave_multicast(&mut self, addr: IpAddr)
pub fn leave_multicast(&mut self, addr: IpAddr)
leave multicast - remove the multicast address from the listener
sourcepub fn enable_all_coap(&mut self, segment: u8)
pub fn enable_all_coap(&mut self, segment: u8)
enable AllCoAP multicasts - adds the AllCoap addresses to the listener
- IPv4 AllCoAP multicast address is ‘224.0.1.187’
- IPv6 AllCoAp multicast addresses are ‘ff0?::fd’
Parameter segment is used with IPv6 to determine the first octet.
- It’s value can be between 0x0 and 0xf.
- To join multiple segments, you have to call enable_discovery for each of the segments.
For further details see method join_multicast