I'm trying to use the below code, but the connect(remote_addr)
fail (error message below).
But it work fine when I use UdpSocket::bind("0.0.0.0:0")
.
0.0.0.0:0
and [::]:0
aren't supposed to be the same thing ?
I don't know if it's a rust-specific issue or just how network work, but I would appreciate an explanation .
let remote_addr: SocketAddr = "127.0.0.1:4567".parse().expect("could not parse addr");
let socket = UdpSocket::bind("[::]:0").expect("could not bind socket");
socket
.connect(remote_addr)
.expect("could not connect to server");
thread 'main' panicked at 'could not connect to server: Os { code: 10014, kind: Uncategorized, message: "Le système a détecté une adresse de pointeur non valide en essayant d’utiliser un argument pointeur dans un appel." }'