pub async fn send_to<A>(&self, buf: &[u8], target: A) -> io::Result<usize>
    where
        A: Into<Address>,
    {
        // ShadowSocks doesn't support UDP fragmentation, so it will always be 0
        let header = UdpAssociateHeader::new(0, target.into());
        let header_len = header.serialized_len();
        let mut send_buf = BytesMut::with_capacity(header.serialized_len() + buf.len());
        header.write_to_buf(&mut send_buf);
        send_buf.put_slice(buf);

        let n = self.socket.send(&send_buf).await?;
        Ok(if n <= header_len { 0 } else { n - header_len })
    }
/// Returns a future that sends data on the socket to the given address.
Returns a future that sends data on the socket to the given address.
Returns a future that sends data on the socket to the given address .
pub async fn send_to<A>(&self, buf: &[u8], target: A) -> io::Result<usize>
    where
        A: Into<Address>,
    {
        // ShadowSocks doesn't support UDP fragmentation, so it will always be 0
        let header = UdpAssociateHeader::new(0, target.into());
        let header_len = header.serialized_len();
        let mut send_buf = BytesMut::with_capacity(header.serialized_len() + buf.len());
        header.write_to_buf(&mut send_buf);
        send_buf.put_slice(buf);
        let n = self.socket.send(&send_buf).await?;
        Ok(if n <= header_len { 0 } else { n - header_len })
    }
pub async fn send_to < A > ( & self , buf : & [ u8 ] , target : A ) -> io :: Result < usize > where A : Into < Address > , { // ShadowSocks doesn't support UDP fragmentation, so it will always be 0 let header = UdpAssociateHeader :: new ( 0 , target . into ( ) ) ; let header_len = header . serialized_len ( ) ; let mut send_buf = BytesMut :: with_capacity ( header . serialized_len ( ) + buf . len ( ) ) ; header . write_to_buf ( & mut send_buf ) ; send_buf . put_slice ( buf ) ; let n = self . socket . send ( & send_buf ) . await ? ; Ok ( if n <= header_len { 0 } else { n - header_len } ) }
Returns a future that sends data on the socket to the given address.
Returns a future that sends data on the socket to the given address .
&self
buf
&[u8]
target
A