Trait wasmtime_wasi::preview2::command::wasi::sockets::tcp_create_socket::Host
source · pub trait Host {
// Required method
fn create_tcp_socket<'life0, 'async_trait>(
&'life0 mut self,
address_family: IpAddressFamily
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<TcpSocket>, ErrorCode>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Required Methods§
sourcefn create_tcp_socket<'life0, 'async_trait>(
&'life0 mut self,
address_family: IpAddressFamily
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<TcpSocket>, ErrorCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_tcp_socket<'life0, 'async_trait>(
&'life0 mut self,
address_family: IpAddressFamily
) -> Pin<Box<dyn Future<Output = Result<Result<Resource<TcpSocket>, ErrorCode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new TCP socket.
Similar to socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)
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
/connect
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 specifiedaddress-family
is not supported. (EAFNOSUPPORT)new-socket-limit
: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)