udx 0.2.0

Rust port of libudx, a protocol for reliable, multiplex, and congestion controlled streams over udp
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::io;
use udx::UdxSocket;

#[tokio::test]
async fn socket_dgrams() -> io::Result<()> {
    let socka = UdxSocket::bind("127.0.0.1:0")?;
    let sockb = UdxSocket::bind("127.0.0.1:0")?;

    let msg = "hi!".as_bytes();
    socka.send(sockb.local_addr()?, msg);
    let (_from, buf) = sockb.recv().await?;
    assert_eq!(&buf, msg);

    Ok(())
}