Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #server
- react {
- whenever IO::Socket::Async.listen('localhost', 3335) -> $conn {
- whenever $conn.Supply(:bin) -> $buf {
- my $str = $buf.decode('UTF-8');
- await $conn.print(($str).encode('UTF-8'));
- }
- }
- }
- #client
- await IO::Socket::Async.connect('localhost', 3335).then( -> $conn {
- if $conn.status {
- given $conn.result {
- .print("123");
- react {
- whenever .Supply() -> $v {
- say $v;
- done;
- }
- }
- .close;
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement