On Wed, 01 Feb 2017 09:03:37 -0800, rober...@semistable.com wrote:
> hi everyone,
> 
> I have these two tiny pieces of code:
> 
> ---------------------------8<-- server.p6 --------------------------
> my $listen = IO::Socket::INET.new(:listen, :localhost<127.0.0.1>,
> :localport(3333));
> loop {
>     my $conn = $listen.accept;
>     while my $buf = $conn.recv(:bin) {
>         $conn.write($buf);
>     }   
>     $conn.close;
> }
> --------------------------->8---------------------------------------
> 
> ---------------------------8<-- client.p6 --------------------------
> loop (my $i = 0; $i <= $conn_count; $i++) {
>     my $conn = IO::Socket::INET.new(host => '127.0.0.1', port => 3333);
>     loop (my $j = 0; $j <= $echo_count; $j++) {
>         $conn.print("woohoo $i $j\n");
> # critical line below: if removed the server crashes without much
> # evidence of what is going on... a say does the same trick
>         sleep 0.0001;
>     }   
>     $conn.close;
> }
> 
> --------------------------->8---------------------------------------
> 
> I start up the server and then the client, which runs for about 20s and
> then exits as expected. the server stays up.
> 
> if you remove the sleep in the client, the server process stops at some
> point through without any output.
> 
> This is Rakudo version 2017.01-132-g97359ae built on MoarVM version
> 2017.01-25-g70d4bd5
> 
> please let me know if there is anything I can do to help debug or
> understand better
> 
> thanks  robert
> 

Can't reproduce on 2017.01-121-gf94cb21. Your client script is using 
$conn_count and $echo_count but neither is defined. What values are those 
supposed to be at? Is there anything else missing?

Reply via email to