Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- v6.c;
- sub connect_to {
- my $host = @_[0];
- my $port = @_[1];
- my $socket = IO::Socket::Async.connect($host, $port).result;
- # my $socket = IO::Socket::INET.new(:$host, :$port);
- # $socket.say;
- return $socket;
- }
- sub interact {
- my $socket = @_[0];
- react {
- whenever $socket.Supply() -> $s {
- $s.say;
- }
- whenever $*IN.Supply() -> $s {
- $socket.print($s);
- }
- }
- }
- my $server = connect_to('localhost', 1234);
- interact($server);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement