mirror of
https://github.com/maciejpedzich/f1-game-packet-parser.git
synced 2025-04-18 18:51:11 +02:00
feat: create a basic UDP client that reports parsing errors
This commit is contained in:
parent
ac7130fae1
commit
10dcca8aff
14
src/bin/udpclient.rs
Normal file
14
src/bin/udpclient.rs
Normal 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)?;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user