std::net::UdpSocket -> u16 port?

I have a UdpSocket in std::net - Rust

I want to extract the u16 port it is bound on. Is this possible? If not, why ?

How about local_addr?


Udp sockets are kind of weird in that you can connect to multiple remote addresses at the same time or not connect at all and instead pass the address on every send and receive operation (using the *_to methods)

1 Like

I was under the impression that bind/bound always refers to the local port. UdpSocket in std::net - Rust

Maybe. I'm not all that familiar with the socket api.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.