Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl6
- my $port = 3333 ;
- say "listen port $port" ;
- react {
- my $ids = 0 ;
- whenever IO::Socket::Async.listen('0.0.0.0', $port ) -> $conn {
- my $id = $ids++ ;
- $conn.print( "$id: hellon") ;
- whenever $conn.Supply.lines -> $line {
- say "$id: $line" ;
- $conn.print( "$id : $linen") ;
- }
- }
- }
- #!/usr/bin/env perl6
- my $port = 3333 ;
- my $conn = await IO::Socket::Async.connect('localhost', $port );
- $conn.print: "{time}n";
- #$conn.Supply.tap(-> $v { print $v });
- sleep 1 ;
- $conn.close;
- listen port 3333
- 0: 1524671069
- An operation first awaited:
- in block <unit> at ./server2.p6 line 5
- Died with the exception:
- connection reset by peer
- in block <unit> at ./server2.p6 line 5
- X::AdHoc+{X::Await::Died}: connection reset by peer
Add Comment
Please, Sign In to add comment