Skip to content

Instantly share code, notes, and snippets.

@moritz
Created March 28, 2011 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/890168 to your computer and use it in GitHub Desktop.
Save moritz/890168 to your computer and use it in GitHub Desktop.
$ cat server.pl
my $s = IO::Socket::INET.new(:localhost('::1'), :localport(1024), :listen);
say "Server running";
while my $client = $s.accept {
print $client.recv();
$client.close;
}
$ ./perl6 server.pl
Server running
# on another shell:
$ nmap -6 ::1
Starting Nmap 5.00 ( http://nmap.org ) at 2011-03-28 10:49 CEST
Interesting ports on localhost (::1):
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
631/tcp open ipp
5432/tcp open postgresql
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment