ibrahim-tcp 1.0.0

High-performance lightweight TCP protocol with reliability, compression, and fault tolerance
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use ibrahim_tcp::{Packet, Server};
use tokio::time::{sleep, Duration};

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let server = Server::new("0.0.0.0:4000").await?;
    println!("[Ibrahim TCP] Server started on 0.0.0.0:4000");
    let mut tick = 0u64;
    loop {
        let pkt = Packet::new(tick, format!("tick={}", tick), true);
        server.broadcast(&pkt).await;
        tick += 1;
        sleep(Duration::from_secs(1)).await;
    }
}