Skip to main content

bind_udp_socket_with_connect_default_dns

Function bind_udp_socket_with_connect_default_dns 

pub async fn bind_udp_socket_with_connect_default_dns(
    address: impl Into<HostWithPort>,
    extensions: Option<&Extensions>,
) -> Result<UdpSocket, Box<dyn Error + Send + Sync>>
Expand description

Bind a UdpSocket to the local interface and connect to the given host and port using the global DNS resolver, in case the host is a Domain, otherwise the IpAddr will be used as-is.

This is a convenience wrapper around bind_udp_socket_with_connect that uses GlobalDnsResolver.

Returns an error if the host is not compatible or cannot be resolve or if all resolved addresses fail to connect.

Calling connect on a UDP socket does not establish a transport level session. It sets the default remote peer and allows using send instead of send_to.