4 releases (2 breaking)
0.3.1 | May 17, 2023 |
---|---|
0.3.0 | May 17, 2023 |
0.2.0 | May 16, 2023 |
0.1.0 | Apr 24, 2023 |
#38 in #udp-socket
63 downloads per month
12KB
257 lines
mocopi-parser
mocopi-parser is a parser library of streamed data from mocopi.
Example
This example using local-ip-address crate.
use std::net::UdpSocket;
use local_ip_address::local_ip;
fn main() {
let ip = local_ip().unwrap();
let port = 12351;
let addr = format!("{}:{}", ip, port);
let socket = UdpSocket::bind(&addr).unwrap();
let mut buff = [0u8; 2048];
loop {
socket.recv_from(buff).unwrap();
let packet = mocopi_parser::parse(&buff).unwrap();
println!("{:?}", packet);
}
}
References
Dependencies
~1.2–2MB
~41K SLoC