#udp

udp_server

fast udp server frame

31 releases (5 stable)

1.0.4 Jan 18, 2024
1.0.3 Mar 6, 2023
1.0.2 Feb 27, 2023
0.5.1 Feb 21, 2023
0.3.6 Oct 30, 2020

#1365 in Network programming

Download history 12/week @ 2023-11-06 38/week @ 2023-11-13 41/week @ 2023-11-20 39/week @ 2023-11-27 37/week @ 2023-12-04 11/week @ 2023-12-11 39/week @ 2023-12-18 97/week @ 2023-12-25 5/week @ 2024-01-01 10/week @ 2024-01-08 105/week @ 2024-01-15 13/week @ 2024-01-22 67/week @ 2024-01-29 13/week @ 2024-02-05 137/week @ 2024-02-12 594/week @ 2024-02-19

811 downloads per month
Used in kcpserver

MIT/Apache

15KB
324 lines

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(())
}

Dependencies

~4–11MB
~88K SLoC