pub async fn bind_for(bind_addr: &ManagerAddr) -> io::Result<ManagerDatagram> {
        match *bind_addr {
            ManagerAddr::SocketAddr(..) | ManagerAddr::DomainName(..) => {
                // Bind to 0.0.0.0 and let system allocate a port
                let local_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0);
                Ok(ManagerDatagram::UdpDatagram(create_udp_socket(&local_addr).await?))
            }
            #[cfg(unix)]
            // For unix socket, it doesn't need to bind to any valid address
            // Because manager won't response to you
            ManagerAddr::UnixSocketAddr(..) => Ok(ManagerDatagram::UnixDatagram(UnixDatagram::unbound()?)),
        }
    }
/// Create a `ManagerDatagram` for sending data to manager
Create a `ManagerDatagram` for sending data to manager
Create a ` ManagerDatagram ` for sending data to manager
pub async fn bind_for(bind_addr: &ManagerAddr) -> io::Result<ManagerDatagram> {
        match *bind_addr {
            ManagerAddr::SocketAddr(..) | ManagerAddr::DomainName(..) => {
                // Bind to 0.0.0.0 and let system allocate a port
                let local_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0);
                Ok(ManagerDatagram::UdpDatagram(create_udp_socket(&local_addr).await?))
            }
            #[cfg(unix)]
            // For unix socket, it doesn't need to bind to any valid address
            // Because manager won't response to you
            ManagerAddr::UnixSocketAddr(..) => Ok(ManagerDatagram::UnixDatagram(UnixDatagram::unbound()?)),
        }
    }
pub async fn bind_for ( bind_addr : & ManagerAddr ) -> io :: Result < ManagerDatagram > { match * bind_addr { ManagerAddr :: SocketAddr ( .. ) | ManagerAddr :: DomainName ( .. ) => { // Bind to 0.0.0.0 and let system allocate a port let local_addr = SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ) , 0 ) ; Ok ( ManagerDatagram :: UdpDatagram ( create_udp_socket ( & local_addr ) . await ? ) ) } # [ cfg ( unix ) ] // For unix socket, it doesn't need to bind to any valid address // Because manager won't response to you ManagerAddr :: UnixSocketAddr ( .. ) => Ok ( ManagerDatagram :: UnixDatagram ( UnixDatagram :: unbound ( ) ? ) ) , } }
Create a `ManagerDatagram` for sending data to manager
Create a ` ManagerDatagram ` for sending data to manager
bind_addr
&ManagerAddr
bind_addr
&ManagerAddr