mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 06:02:05 +00:00
Send UDP packets to multicast address rather than broadcast address (#6331)
A smart router or switch is able to snoop the multicast address to only send the packets to nodes listening on the multicast address. Before all machines reachable on the L2 layer would receive the packet.
This commit is contained in:
parent
2d565c2921
commit
96ba94843b
@ -56,7 +56,7 @@ class UdpMulticastThread : public concurrency::OSThread
|
|||||||
LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id);
|
LOG_DEBUG("Broadcasting packet over UDP (id=%u)", mp->id);
|
||||||
uint8_t buffer[meshtastic_MeshPacket_size];
|
uint8_t buffer[meshtastic_MeshPacket_size];
|
||||||
size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp);
|
size_t encodedLength = pb_encode_to_bytes(buffer, sizeof(buffer), &meshtastic_MeshPacket_msg, mp);
|
||||||
udp.broadcastTo(buffer, encodedLength, UDP_MULTICAST_DEFAUL_PORT);
|
udp.writeTo(buffer, encodedLength, udpIpAddress, UDP_MULTICAST_DEFAUL_PORT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user