pub struct UdpSocket<const TIMER_HZ: u32, const L: usize> { /* private fields */ }
Expand description

A User Datagram Protocol socket.

A UDP socket is bound to a specific endpoint, and owns transmit and receive packet buffers.

Implementations

Create an UDP socket with the given buffers.

Return the socket handle.

Return the bound endpoint.

Return the connection state, in terms of the UDP connection.

Set available data.

Get the number of bytes available to ingress.

Bind the socket to the given endpoint.

This function returns Err(Error::Illegal) if the socket was open (see is_open), and Err(Error::Unaddressable) if the port in the given endpoint is zero.

Check whether the socket is open.

Check whether the receive buffer is full.

Dequeue a packet received from a remote endpoint, and return the endpoint as well as a pointer to the payload.

This function returns Err(Error::Exhausted) if the receive buffer is empty.

Dequeue a packet received from a remote endpoint, copy the payload into the given slice, and return the amount of octets copied as well as the endpoint.

See also recv.

Peek at a packet received from a remote endpoint, and return the endpoint as well as a pointer to the payload without removing the packet from the receive buffer. This function otherwise behaves identically to recv.

It returns Err(Error::Exhausted) if the receive buffer is empty.

Peek at a packet received from a remote endpoint, copy the payload into the given slice, and return the amount of octets copied as well as the endpoint without removing the packet from the receive buffer. This function otherwise behaves identically to recv_slice.

See also peek.

Trait Implementations

Formats the value using the given formatter. Read more
Converts this type into the (usually inferred) input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.