Echo server: Difference between revisions

m
→‎{{header|Perl 6}}: "async" is now "start"
m (→‎{{header|LFE}}: Fixed typo)
m (→‎{{header|Perl 6}}: "async" is now "start")
Line 1,335:
By default it spawns 5 child processes at startup, makes sure there are always at least 2 and at most 10 spare children available for new requests, each of which will be killed after processing 1000 requests and new ones will take their place.
=={{header|Perl 6}}==
{{works with|rakudo|2015-09-09}}
<lang perl6>my $socket = IO::Socket::INET.new:
localhost => 'localhost',
Line 1,342 ⟶ 1,343:
while $socket.accept -> $conn {
say "Accepted connection";
asyncstart {
while $conn.recv -> $stuff {
say "Echoing $stuff";
Line 1,350 ⟶ 1,351:
}
}</lang>
This is supposed to work, but <tt>async</tt> is currently busted. Substituting <tt>do</tt> will allow it to limp along as a single-threaded server.
 
=={{header|PHP}}==
Anonymous user