ack-udp

Crates.ioack-udp
lib.rsack-udp
version0.1.14
sourcesrc
created_at2023-05-02 11:35:25.368879
updated_at2023-05-06 12:58:08.318926
descriptionA bit more reliable UDP
homepagehttps://github.com/IDSaves/ack-udp
repositoryhttps://github.com/IDSaves/ack-udp
max_upload_size
id854467
size23,597
Ivan Davydov (IDSaves)

documentation

README

AckUDP

[EXPERIMENTAL] A bit more reliable version of UDP written in Rust.

How to use?

use std::{io, thread, time::Duration};

use ack_udp::AckUdp;

#[tokio::main]
fn main() -> io::Result<()> {
  // Creating sender and receiver sockets
  let mut sender = AckUdp::new("127.0.0.1:9023".parse().unwrap()).await?;
  let mut receiver = AckUdp::new("127.0.0.1:9024".parse().unwrap()).await?;

  let message = String::from("test").as_bytes().to_vec();
  
  let status = sender.send(&message, "127.0.0.1:9024".parse().unwrap())?;
  println!("{:?}", status); // Printing the status of the send

  thread::sleep(Duration::from_millis(5)); // Simulating the wait time

  // Receiving data
  let (_, datagram) = receiver.recv().unwrap(); 
  println!("{:?}, {:?}", datagram, status);

  Ok(())
}
Commit count: 13

cargo fmt