pub struct UdpSocket { /* private fields */ }
Expand description

Tokio-compatible UDP socket with some useful specializations.

Unlike a standard tokio UDP socket, this allows ECN bits to be read and written on some platforms.

Implementations

Creates a new UDP socket from a previously created std::net::UdpSocket

create a new UDP socket and attempt to bind to addr

sets the value of SO_BROADCAST for this socket

Sends data on the socket to the given address. On success, returns the number of bytes written.

calls underlying tokio send_to

Sends data on the socket to the given address. On success, returns the number of bytes written.

calls underlying tokio poll_send_to

Sends data on the socket to the remote address that the socket is connected to.

See tokio send

Sends data on the socket to the remote address that the socket is connected to.

See tokio poll_send

Receives a single datagram message on the socket. On success, returns the number of bytes read and the origin.

See tokio recv_from

Receives a single datagram message on the socket. On success, returns the number of bytes read and the origin.

See tokio poll_recv_from

Receives a single datagram message on the socket from the remote address to which it is connected. On success, returns the number of bytes read.

See tokio recv

Receives a single datagram message on the socket from the remote address to which it is connected. On success, returns the number of bytes read.

See tokio poll_recv

Calls syscall sendmmsg. With a given state configured GSO and transmits with information on the data and metadata about outgoing packets.

Calls syscall sendmsg. With a given state configured GSO and transmit with information on the data and metadata about outgoing packet.

async version of recvmmsg

recv_msg is similar to recv_from but returns extra information about the packet in RecvMeta.

calls sendmmsg

calls sendmsg

calls recvmsg

calls recvmmsg

Returns local address this socket is bound to.

Trait Implementations

Extracts the raw file descriptor. Read more

Formats the value using the given formatter. Read more

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more