In IO::Socket::Async§
See primary documentation in context for method listen
method listen(Str $host, Int $port --> Supply)
Creates a listening socket on the specified $host
and $port
, returning a Supply
to which the accepted client IO::Socket::Async
s 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.