feat: create a basic UDP client that reports parsing errors

This commit is contained in:
Maciej Pędzich 2025-02-19 14:12:14 +01:00
parent ac7130fae1
commit 10dcca8aff
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D

14
src/bin/udpclient.rs Normal file
View File

@ -0,0 +1,14 @@
use f1_game_packet_parser::parse;
use std::error::Error;
use std::net::UdpSocket;
fn main() -> Result<(), Box<dyn Error>> {
let socket = UdpSocket::bind("127.0.0.1:20777")?;
let mut buf = [0u8; 2048];
loop {
let (msg_size, _) = socket.recv_from(&mut buf)?;
let raw_data = &buf[..msg_size];
let _parse_result = parse(raw_data)?;
}
}