-
-
Save AlexDaniel/00198fac369062afb76cc35a435f70ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start { | |
react { | |
whenever IO::Socket::Async.listen('localhost', 3333) -> $connection { | |
whenever $connection.Supply.lines -> $line { | |
die unless $line eq 'ping'; # just checking... | |
$connection.print( "pong\n" ); | |
} | |
} | |
} | |
} | |
sleep 0.3; | |
my $connection = IO::Socket::INET.new( host => 'localhost', port => 3333 ); | |
my $start = now; | |
for ^50000 { | |
$connection.put( 'ping' ); | |
my $status = $connection.get( ); | |
die unless $status eq 'pong'; # just checking... | |
} | |
my $time = now - $start; | |
say $time; | |
exit 42 if $time < 7; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment