Skip to content

Instantly share code, notes, and snippets.

@bioduds
Created June 11, 2017 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bioduds/01b17be1585fba3b8c16772b0af6ae23 to your computer and use it in GitHub Desktop.
Save bioduds/01b17be1585fba3b8c16772b0af6ae23 to your computer and use it in GitHub Desktop.
trying these
my $socket = IO::Socket::Async.bind-udp('localhost', 5000);
react {
whenever $socket.Supply -> $v {
if $v.chars > 0 {
say $v;
}
}
}
# await IO::Socket::Async.connect('localhost', 5000).then( -> $p {
# if $p.status {
# given $p.result {
# .print('Hello, Perl 6');
# react {
# whenever .Supply() -> $v {
# $v.say;
# done;
# }
# }
# .close;
# }
# }
# });
# my $listen = IO::Socket::INET.new(:listen, :localhost<localhost>, :localport(5000));
#
# loop {
# my $conn = $listen.accept;
# while my $buf = $conn.recv(:bin) {
# $conn.write: $buf;
# }
# $conn.close;
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment