Crates.io | mocopi_parser |
lib.rs | mocopi_parser |
version | 0.3.1 |
source | src |
created_at | 2023-04-24 09:54:26.440593 |
updated_at | 2023-05-17 05:45:20.047258 |
description | A parser of streamed data from mocopi |
homepage | |
repository | |
max_upload_size | |
id | 847270 |
size | 11,241 |
mocopi-parser is a parser library of streamed data from mocopi.
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);
}
}