Skip to content

🦀 A bit more reliable UDP written in Rust

Notifications You must be signed in to change notification settings

idavydoff/ack-udp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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(())
}

About

🦀 A bit more reliable UDP written in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages