Created
June 11, 2017 16:53
-
-
Save bioduds/629b1f88e1a778f13309f5651659319f to your computer and use it in GitHub Desktop.
How to respond now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### So, I got this to listen to incoming requests | |
#unit package EC::Network:auth<github:bioduds>; | |
unit module EC::Network; | |
class Socket { | |
has $.listener; | |
method run { | |
loop { | |
my $conn = $!listener.accept; | |
while my $buf = $conn.recv( :bin ) { | |
$conn.write: $buf; | |
say "yo from listener"; | |
} | |
$conn.close; | |
} | |
} | |
} | |
### called by | |
use v6; | |
use lib 'lib/network'; | |
use p2p; | |
say "Running Test..."; | |
EC::Network::Socket.new( | |
:listener( IO::Socket::INET.new( | |
:listen, :localhost<192.168.1.106>, :localport(5000) ) ) ).run; | |
### Here's the output | |
BITWORKERS dev # perl6 test.p6 | |
Running Test... | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
yo from listener | |
#### each yo from listener was a call made from Postman in a different computer inside the LAN | |
### Now how do I respond?? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment