pub struct UdpConn {
socket: Arc<UdpSocket>,
}Expand description
Raw UDP connection. Sends and receives raw bytes with addresses.
Fields§
§socket: Arc<UdpSocket>Implementations§
Source§impl UdpConn
impl UdpConn
Sourcepub async fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize>
pub async fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize>
Send raw bytes to an address.
Sourcepub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, SocketAddr)>
Receive raw bytes. Returns (bytes_read, sender address).
Sourcepub fn local_endpoint(&self) -> Result<Endpoint>
pub fn local_endpoint(&self) -> Result<Endpoint>
Local address this socket is bound to.
Sourcepub fn peer_endpoint(&self) -> Result<Endpoint>
pub fn peer_endpoint(&self) -> Result<Endpoint>
Peer address (if connected via dial).
Auto Trait Implementations§
impl Freeze for UdpConn
impl RefUnwindSafe for UdpConn
impl Send for UdpConn
impl Sync for UdpConn
impl Unpin for UdpConn
impl UnsafeUnpin for UdpConn
impl UnwindSafe for UdpConn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more