Hello world/Web server: Difference between revisions
Content added Content deleted
(→{{header|C}}: simplified code, dropped fork(), serving HTML5 (!)) |
|||
Line 127: | Line 127: | ||
"<html><head><title>Goodbye, world!</title></head><body>Goodbye, world!</body></html>\r\n"; |
"<html><head><title>Goodbye, world!</title></head><body>Goodbye, world!</body></html>\r\n"; |
||
close $client; |
close $client; |
||
}</lang> |
|||
Using Perl's glue power, provide a suicide note with visitor counter via netcat:<lang Perl>while (++(our $vn)) { |
|||
open NC, "|-", qw(nc -l -p 8080 -q 1); |
|||
print NC "HTTP/1.0 200 OK\xd\xa", |
|||
"Content-type: text/plain; charset=utf-8\xd\xa\xd\xa", |
|||
"Goodbye, World! (hello, visitor No. $vn!)\xd\xa"; |
|||
}</lang> |
}</lang> |
||