Struct wasi::sockets::udp::IncomingDatagramStream
source · pub struct IncomingDatagramStream { /* private fields */ }
Implementations§
source§impl IncomingDatagramStream
impl IncomingDatagramStream
sourcepub fn receive(
&self,
max_results: u64
) -> Result<Vec<IncomingDatagram>, ErrorCode>
pub fn receive( &self, max_results: u64 ) -> Result<Vec<IncomingDatagram>, ErrorCode>
Receive messages on the socket.
This function attempts to receive up to max-results
datagrams on the socket without blocking.
The returned list may contain fewer elements than requested, but never more.
This function returns successfully with an empty list when either:
max-results
is 0, or:max-results
is greater than 0, but no results are immediately available. This function never returnserror(would-block)
.
§Typical errors
remote-unreachable
: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET)connection-refused
: The connection was refused. (ECONNREFUSED)
§References
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html
- https://man7.org/linux/man-pages/man2/recv.2.html
- https://man7.org/linux/man-pages/man2/recvmmsg.2.html
- https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recv
- https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom
- https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms741687(v=vs.85)
- https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for IncomingDatagramStream
impl RefUnwindSafe for IncomingDatagramStream
impl Send for IncomingDatagramStream
impl Sync for IncomingDatagramStream
impl Unpin for IncomingDatagramStream
impl UnwindSafe for IncomingDatagramStream
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