Why does the following code produce the error at the bottom? What am I missing or doing wrong?
Some equivalent Python code works as expected. Also, the error is not very helpful
let my_addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 13001);
let socket = UdpSocket::bind(my_addr)?;
let addr = SocketAddrV4::new(Ipv4Addr::new(46, 226, 106, 127), 52099);
let buf = "foobar".as_bytes();
socket.send_to(buf, addr)?;
Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }