thermalcam_decoder/examples/replay.rs

18 lines
534 B
Rust
Raw Permalink Normal View History

add a rust replay example, packet has identical data, src port, dest port, dest address existing: 397 2041.095533360 192.168.0.1 192.168.0.255 UDP 252 8091 → 8092 [BAD UDP LENGTH 217 > IP PAYLOAD LENGTH] Len=209 new: 396 2008.927877440 192.168.0.1 192.168.0.255 UDP 70 8091 → 8092 Len=28 old bytes: 0000 ff ff ff ff ff ff 00 01 6c 59 f0 0a 08 00 45 00 ........lY....E. 0010 00 38 28 1d 00 00 80 11 90 47 c0 a8 00 01 c0 a8 .8(......G...... 0020 00 ff 1f 9b 1f 9c 00 d9 00 00 01 20 01 80 1b 40 ........... ...@ 0030 00 20 00 00 00 00 00 00 00 0f 00 00 00 01 00 00 . .............. 0040 01 00 00 20 2b 00 00 00 00 00 00 00 00 00 00 00 ... +........... 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0060 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ................ 0080 ff 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00 ................ 0090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00f0 00 00 00 00 00 00 00 00 00 00 00 00 ............ new bytes: 0000 ff ff ff ff ff ff a8 20 66 11 cb 49 08 00 45 00 ....... f..I..E. 0010 00 38 2b 75 40 00 40 11 8c ef c0 a8 00 01 c0 a8 .8+u@.@......... 0020 00 ff 1f 9b 1f 9c 00 24 82 86 01 20 01 80 1b 40 .......$... ...@ 0030 00 20 00 00 00 00 00 00 00 0f 00 00 00 01 00 00 . .............. 0040 01 00 00 20 2b 00 ... +.
2024-01-19 23:39:20 +02:00
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(())
}