Hello world/Web server: Difference between revisions
Content added Content deleted
(→{{header|Go}}: library path update) |
(Add Perl 6 implementation) |
||
Line 380: | Line 380: | ||
"Content-type: text/plain; charset=utf-8\xd\xa\xd\xa", |
"Content-type: text/plain; charset=utf-8\xd\xa\xd\xa", |
||
"Goodbye, World! (hello, visitor No. $vn!)\xd\xa"; |
"Goodbye, World! (hello, visitor No. $vn!)\xd\xa"; |
||
}</lang> |
|||
=={{header|Perl 6}}== |
|||
{{works with|Rakudo}} |
|||
<lang perl6>my $sock = IO::Socket::INET.new(:localhost('0.0.0.0'), :localport(8080), :listen); |
|||
say "Goodbye Web Server listening on $sock.localhost():$sock.localport()"; |
|||
while $sock.accept -> $client { |
|||
$client.send: "HTTP/1.0 200 OK\r\nContent-Type: text/plain; charset=UTF-8\r\n\r\nGoodbye, World!\r\n"; |
|||
$client.close; |
|||
}</lang> |
}</lang> |
||