Advertisement
Guest User

Untitled

a guest
Oct 12th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!perl6
  2.  
  3. use v6;
  4.  
  5. my Buf $buf;
  6.  
  7. await IO::Socket::Async.connect('test.mosquitto.org',1883).then( -> $p {
  8. if $p.status {
  9. given $p.result {
  10. react {
  11. .write(pack("C C n a* C C n n a*", 16, 15, 6, "MQIsdp", 3, 2, 60, 1, "a"));
  12. my $bs = .bytes-supply;
  13. whenever $bs -> $received {
  14. $received.WHAT.say;
  15. $buf ~= $received;
  16. }
  17. }
  18. .close;
  19. }
  20. }
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement