pub trait Host: Send {
    // Required method
    fn create_udp_socket(
        &mut self,
        address_family: IpAddressFamily,
    ) -> Result<Resource<UdpSocket>, SocketError>;
}

Required Methods§

Source

fn create_udp_socket( &mut self, address_family: IpAddressFamily, ) -> Result<Resource<UdpSocket>, SocketError>

Create a new UDP socket.

Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP) in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and can’t be configured otherwise.

This function does not require a network capability handle. This is considered to be safe because at time of creation, the socket is not bound to any network yet. Up to the moment bind is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

§Typical errors
  • not-supported: The specified address-family is not supported. (EAFNOSUPPORT)
  • new-socket-limit: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
§References:

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized + Send> Host for &mut _T

Source§

fn create_udp_socket( &mut self, address_family: IpAddressFamily, ) -> Result<Resource<UdpSocket>, SocketError>

Create a new UDP socket.

Similar to socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP) in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and can’t be configured otherwise.

This function does not require a network capability handle. This is considered to be safe because at time of creation, the socket is not bound to any network yet. Up to the moment bind is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

§Typical errors
  • not-supported: The specified address-family is not supported. (EAFNOSUPPORT)
  • new-socket-limit: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
§References:

Implementors§

Source§

impl<T> Host for WasiImpl<T>
where T: WasiView,