Skip to main content

sender/
sender.rs

1#![allow(unused_imports)]
2use std::{fs, net::UdpSocket, path::PathBuf, time::Duration};
3
4use serde::{Deserialize, Serialize};
5
6use companion::{companion_addr, Response, Task};
7
8fn main() {
9    let addr = companion_addr();
10
11    let socket = UdpSocket::bind("[::]:0").unwrap();
12    socket.connect(addr).unwrap();
13
14    let mut buf = [0; 65507];
15
16    socket.send(&Task::List.as_bytes()).unwrap();
17
18    let (len, _src) = socket.recv_from(&mut buf).unwrap();
19    let resp = Response::from(&buf[..len]);
20
21    println!("{resp:?}")
22}