18 lines
534 B
Rust
18 lines
534 B
Rust
|
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(())
|
||
|
}
|