udp_server

Crates.ioudp_server
lib.rsudp_server
version1.0.4
sourcesrc
created_at2020-08-19 01:49:49.583945
updated_at2024-01-18 07:30:12.841555
descriptionfast udp server frame.
homepage
repositoryhttps://github.com/luyikk/udp_server
max_upload_size
id278081
size45,864
(luyikk)

documentation

https://docs.rs/udp_server/

README

udp_server

fast rust udp server

Latest Version Rust Documentation Rust Report Card Rust CI

Examples echo

use log::LevelFilter;
use udp_server::prelude::{IUdpPeer, UdpServer};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    env_logger::Builder::new()
        .filter_level(LevelFilter::Debug)
        .init();
    UdpServer::new("0.0.0.0:20001", |peer, mut reader, _| async move {
        while let Some(Ok(data)) = reader.recv().await {
            peer.send(&data).await?;
        }
        Ok(())
    })?
        .set_peer_timeout_sec(20)
        .start(())
        .await?;

    Ok(())
}
Commit count: 77

cargo fmt