use std::net::{ToSocketAddrs, UdpSocket}; use crate::error::Error; /// Sends a buffer on UDP broadcast pub fn send_packet( bind_addr: A, broadcast_addr: A, buffer: &[u8], ) -> Result { let socket = UdpSocket::bind(bind_addr)?; socket.set_broadcast(true)?; Ok(socket.send_to(buffer, broadcast_addr)?) }