aurpc

Crates.ioaurpc
lib.rsaurpc
version0.3.1
sourcesrc
created_at2020-06-16 20:32:50.746511
updated_at2020-06-22 23:25:50.834655
descriptionAsynchronous UDP RPCs
homepage
repositoryhttps://git.ureeves.com/ureeves/aurpc
max_upload_size
id254674
size38,355
Eduardo Leegwater Simões (ureeves)

documentation

https://docs.rs/aurpc

README

Build Status Docs

aurpc

Asynchronous UDP RPCs.

Exposes a socket-like interface allowing for sending requests and awaiting a response as well as listening to requests, with UDP as transport.

This is achieved by implementing an 24-bit protocol header on top of UDP containing 8-bit flags and a 16-bit request id.

                    1                   2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Flags     |           Request Id          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Since a UDP datagram can carry a maximum of 65507 data bytes. This means that, with the added overhead, each message can be a maximum of 65504 bytes.

Examples

use aurpc::RpcSocket;

let socket = RpcSocket::bind("127.0.0.1:8080").await?;
let mut buf = vec![0u8; 1024];

loop {
    let (n, responder) = socket.recv_from(&mut buf).await?;
    responder.respond(&buf[..n]).await?;
}

License

This crate is licensed under the MIT license. See the license for more details.

Commit count: 0

cargo fmt