txt: ## listensocket.md
  class IO::Socket::Async::ListenSocket
  
  A tap for listening TCP sockets
  
  ```raku
  class IO::Socket::Async::ListenSocket is Tap {}
  ```
  
  `IO::Socket::Async::ListenSocket` represents a listening TCP socket. Instances of this are returned by the [tap](/type/Supply#method_tap) method of the supply returned by [IO::Socket::Async.listen](/type/IO/Socket/Async#method_listen):
  
  ```raku
  my IO::Socket::Async::ListenSocket:D $server =
      IO::Socket::Async.listen('127.0.0.1', 0).tap(-> $peer {
          await $peer.print: "Hello. Goodbye!\r\n";
          $peer.close;
      });
  
  my (Str:D $host, Int:D $port) = await $server.socket-host, $server.socket-port;
  say "The rude service is listening on $host:$port for the next 10 seconds...";
  await Promise.in(10).then({ $server.close });
  say "I'm done now.";
  
  ```
  
  Alternatively, by using the `do` prefix with `whenever`, you can also use it from within a `react` block:
  
  ```raku
  react {
      my IO::Socket::Async::ListenSocket:D $server =
          do whenever IO::Socket::Async.listen('127.0.0.1', 0) -> IO::Socket::Async:D $connection {
              await $connection.print: "Hello. Goodbye!\r\n";
              $connection.close;
              QUIT { $server.close; .rethrow }
          };
      # Use $server here somehow.
  }
  
  ```
  
  # [Methods](#class_IO::Socket::Async::ListenSocket "go to top of document")[§](#Methods "direct link")
  
  ## [method socket-host](#class_IO::Socket::Async::ListenSocket "go to top of document")[§](#method_socket-host "direct link")
  
  ```raku
  method socket-host(--> Promise)
  ```
  
  Returns a [`Promise`](/type/Promise) that will be kept with a [`Str`](/type/Str) containing the address of the listening socket.
  
  ## [method socket-port](#class_IO::Socket::Async::ListenSocket "go to top of document")[§](#method_socket-port "direct link")
  
  ```raku
  method socket-port(--> Promise)
  ```
  
  Returns a [`Promise`](/type/Promise) that will be kept with an [`Int`](/type/Int) containing the port of the listening socket.
  
  ## [method native-descriptor](#class_IO::Socket::Async::ListenSocket "go to top of document")[§](#method_native-descriptor "direct link")
  
  ```raku
  method native-descriptor(--> Int)
  ```
  
  Returns the corresponding file descriptor (`SOCKET` on Windows) for the listening socket.
  