pub(crate) fn new<T: ToSocketAddrs>(host_port: T) -> thrift::Result<Self> {
        let (buffer, write) = TBufferChannel::with_capacity(512).split()?;
        let client = agent::AgentSyncClient::new(
            TCompactInputProtocol::new(TNoopChannel),
            TCompactOutputProtocol::new(write),
        );

        let conn = UdpSocket::bind("0.0.0.0:0")?;
        conn.connect(host_port)?;

        Ok(AgentAsyncClientUDP {
            #[cfg(all(not(feature = "async-std"), not(feature = "tokio")))]
            conn,
            #[cfg(feature = "tokio")]
            conn: tokio::sync::Mutex::new(tokio::net::UdpSocket::from_std(conn)?),
            #[cfg(all(feature = "async-std", not(feature = "tokio")))]
            conn: async_std::sync::Mutex::new(async_std::net::UdpSocket::from(conn)),
            buffer_client: Mutex::new(BufferClient { buffer, client }),
        })
    }
/// Create a new UDP agent client
Create a new UDP agent client
Create a new UDP agent client
pub(crate) fn new<T: ToSocketAddrs>(host_port: T) -> thrift::Result<Self> {
        let (buffer, write) = TBufferChannel::with_capacity(512).split()?;
        let client = agent::AgentSyncClient::new(
            TCompactInputProtocol::new(TNoopChannel),
            TCompactOutputProtocol::new(write),
        );
        let conn = UdpSocket::bind("0.0.0.0:0")?;
        conn.connect(host_port)?;
        Ok(AgentAsyncClientUDP {
            #[cfg(all(not(feature = "async-std"), not(feature = "tokio")))]
            conn,
            #[cfg(feature = "tokio")]
            conn: tokio::sync::Mutex::new(tokio::net::UdpSocket::from_std(conn)?),
            #[cfg(all(feature = "async-std", not(feature = "tokio")))]
            conn: async_std::sync::Mutex::new(async_std::net::UdpSocket::from(conn)),
            buffer_client: Mutex::new(BufferClient { buffer, client }),
        })
    }
pub ( crate ) fn new < T : ToSocketAddrs > ( host_port : T ) -> thrift :: Result < Self > { let ( buffer , write ) = TBufferChannel :: with_capacity ( 512 ) . split ( ) ? ; let client = agent :: AgentSyncClient :: new ( TCompactInputProtocol :: new ( TNoopChannel ) , TCompactOutputProtocol :: new ( write ) , ) ; let conn = UdpSocket :: bind ( " " ) ? ; conn . connect ( host_port ) ? ; Ok ( AgentAsyncClientUDP { # [ cfg ( all ( not ( feature " " ) not ( feature " " ) ) ) ] conn , # [ cfg ( feature " " ) ] conn : tokio :: sync :: Mutex :: new ( tokio :: net :: UdpSocket :: from_std ( conn ) ? ) , # [ cfg ( all ( feature " " not ( feature " " ) ) ) ] conn : async_std :: sync :: Mutex :: new ( async_std :: net :: UdpSocket :: from ( conn ) ) , buffer_client : Mutex :: new ( BufferClient { buffer , client } ) , } ) }
Create a new UDP agent client
Create a new UDP agent client
host_port
T
host_port
T