pub async fn send_file<T: Clone + 'static + ToSocketAddrs + Send + Copy + Display>(
source: Source,
file_name: &str,
reciever: T
) -> Result<(), Box<dyn Error + Send + Sync>>
Expand description
This is used to send files
Example
let port = 3456;
println!("my ip: 127.0.0.1:{}", port);
send_file(
Source::Port(port),
"./examples/file_to_send.txt",
"127.0.0.1:7890",
)
.await
.expect("error when sending file");
This takes in a source which is the udp socket to send from
This will listen for any recievers on port 3456 on ip 127.0.0.1. Note: localhost and 127.0.0.1 are the same.