diff --git a/examples/replay.rs b/examples/replay.rs new file mode 100644 index 0000000..eeba1dc --- /dev/null +++ b/examples/replay.rs @@ -0,0 +1,17 @@ +use std::net::UdpSocket; + +fn main() -> std::io::Result<()> { + { + let socket = UdpSocket::bind("192.168.0.1:8091")?; + + // Receives a single datagram message on the socket. If `buf` is too small to hold + // the message, it will be cut off. + let buf = [ + 1, 0x20, 1, 0x80, 0x1b, 0x40, 0, 0x20, 0, 0, 0, 0, 0, 0, 0, 0x0f, 0, 0, 0, 1, 0, 0, 1, + 0, 0, 0x20, 0x2b, 0, + ]; + socket.set_broadcast(true)?; + socket.send_to(&buf, "192.168.0.255:8092")?; + } + Ok(()) +}