Created
September 3, 2022 20:39
-
-
Save peterdelevoryas/2bb2212f42fa8e698c8e9255ae84e69a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::net::UdpSocket; | |
use std::env; | |
fn main() { | |
let src = env::args().nth(1).unwrap(); | |
let dst = env::args().nth(2).unwrap(); | |
println!("src {} dst {}", src, dst); | |
let mut buf = [0; 256]; | |
let fd = UdpSocket::bind(&src).unwrap(); | |
fd.send_to(b"hi rachel", &dst).unwrap(); | |
fd.recv_from(&mut buf).unwrap(); | |
println!("Received: {}", std::str::from_utf8(&buf).unwrap()); | |
} |
Author
peterdelevoryas
commented
Sep 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment