Yet another project rewritten in Rust.
Features
Stream
/Sink
/Future
based async API.- Support
Unreliable
,Reliable
andReliableOrdered
packets. - Support multiple order channels.
- Support
ACK
/NACK
mechanism. - Low level API but easy to use.
Roadmap
- Add sliding window congestion control
Getting Started
See examples for usage.
Server
IO is a hidden type that implements the traits Stream
and Sink
.
Never stop polling incoming
because it also serves as the router to every IOs.
Apply Sink::poll_flush
to IO will trigger to flush all pending packets, ACK
/NACK
, and stale packets.
use Bytes;
use ;
use ;
let socket = bind.await?;
let config = default
.send_buf_cap
.sever_guid
.advertisement
...
.build
.unwrap;
let mut incoming = socket.make_incoming;
let mut io = incoming.next.await.unwrap;
let data: Bytes = io.next.await.unwrap;
io.send.await.unwrap;
Client
The current version of the client only has the most basic handshake implementation, and it is not recommended to use it directly.
use Bytes;
use ;
use ;
let socket = bind.await?;
let config = default
.send_buf_cap
.client_guid
...
.build
.unwrap;
let mut conn = socket.connect_to.await?;
conn.send
.await?;
let res: Bytes = conn.next.await.unwrap;