Wasm Directoryalpha
Resource

incoming-datagram-stream

No description available.

resource incoming-datagram-stream;

F receive

receive: func(max-results: u64) -> result​<list​<incoming-datagram>, error-code>;

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 returns error(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

F subscribe

subscribe: func() -> pollable;

Create a pollable which will resolve once the stream is ready to receive again.

Note: this function is here for WASI 0.2 only. It's planned to be removed when future is natively supported in Preview3.