Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. method connect () {
  2. start {
  3. my $conn = await IO::Socket::Async.connect($!host, $!port);
  4.  
  5. $!incoming = self!process-messages($conn.Supply(:bin));
  6. await $!incoming;
  7. $!connection = $conn;
  8. True
  9. }
  10. }
  11.  
  12. method login () {
  13. say $!connection.write(0xffdeadbeef);
  14. say 'foo';
  15. }
  16.  
  17. method !process-messages($incoming) {
  18. supply {
  19. my @chars = '';
  20. whenever $incoming -> $data {
  21. say $data.unpack('H');
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement