# rust-raknet [](https://github.com/b23r0/rust-raknet/actions/workflows/rust.yml) [](https://discord.gg/ZKtYMvDFN4) [](https://crates.io/crates/rust-raknet) [](https://docs.rs/rust-raknet/latest/rust_raknet/)
RakNet Protocol implementation by Rust.
Raknet is a reliable udp transport protocol that is generally used for communication between game clients and servers, and is used by Minecraft Bedrock Edtion for underlying communication.
Raknet protocol supports multiple reliability, and has better transmission performance than TCP in unstable network environments. This project is an incomplete implementation of the protocol.
Reference : http://www.jenkinssoftware.com/raknet/manual/index.html
_This project is not affiliated with Jenkins Software LLC nor RakNet._
# Features
* Async
* MIT License
* Pure Rust implementation
* Fast Retransmission
* Selective Retransmission (TCP/Full Retransmission)
* Non-delayed ACK (TCP/Delayed ACK)
* RTO Not Doubled (TCP/RTO Doubled)
* Linux/Windows/Mac/BSD support
* Compatible with Minecraft 1.18.x
# Get Started
```toml
# Cargo.toml
[dependencies]
rust-raknet = "*"
```
Documentation : https://docs.rs/rust-raknet/latest/rust_raknet/
# Reliability
- [x] unreliable
- [x] unreliable sequenced
- [x] reliable
- [x] reliable ordered
- [x] reliable sequenced
# Example
```rs
//server
async fn serve(){
let mut listener = RaknetListener::bind("127.0.0.1:19132".parse().unwrap()).await.unwrap();
listener.listen().await;
loop{
let mut socket = listener.accept().await.unwrap();
let buf = socket.recv().await.unwrap();
if buf[0] == 0xfe{
//do something
}
}
}
```
```rs
//client
async fn connect(){
let socket = RaknetSocket::connect("127.0.0.1:19132".parse().unwrap()).await.unwrap();
socket.send(&[0xfe], Reliability::ReliableOrdered).await.unwrap();
let buf = socket.recv().await.unwrap();
if buf[0] == 0xfe{
//do something
}
}
```
# Contribution
If you want to develop with me, you can contact me via discord or email.