listen
ErrorsCollection

listen

Synthesised documentation from type/IO/Socket/Async

From type/IO/Socket/Async

See Original text in context

method listen(Str $hostInt $port --> Supply)

Creates a listening socket on the specified $host and $port, returning a Supply to which the accepted client IO::Socket::Asyncs will be emitted. This Supply should be tapped start listening for client connections. You can set $port to 0 if you want the operating system to find one for you.

The IO::Socket::Async::ListenSocket returned by calling the tap method on the supply returned represents the underlying listening TCP socket, which can be closed using its close method. If $port was set to 0, you can get the port the socket ended up with using its socket-port method.