Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- simula67@hades ~/repos/perl6/7test » cat server.p6
- #!/opt/perl6/bin/perl6
- constant DOUBLE_CRLF = "\x0D\x0A\x0D\x0A";
- #constant DOUBLE_CRLF = "END";
- my $listener = IO::Socket::INET.new(
- :localhost("0.0.0.0"),
- :localport(3000),
- :listen(1),
- :input-line-separator(DOUBLE_CRLF)
- );
- say "Listening..";
- while my $client = $listener.accept {
- my Str $preamble = $client.get;
- say $preamble;
- say "preamble has " ~ $preamble.chars ~ " chars";
- $client.close;
- }
- simula67@hades ~/repos/perl6/7test » cat client.p6
- #!/opt/perl6/bin/perl6
- constant CRLF = "\x0D\x0A";
- my $socket = IO::Socket::INET.new(
- host => '127.0.0.1',
- port => 3000,
- Proto => 'tcp',
- ) or die "Couldn't connect to Server\n";
- $socket.send("Some stuff" ~ CRLF);
- $socket.send("Got more stuff END" ~ CRLF);
- $socket.send(CRLF);
- simula67@hades ~/repos/perl6/7test » perl6-m server.p6 # MOAR OUTPUT IS WRONG !!!!!!!!!!!!
- Listening.. # MOAR OUTPUT IS WRONG !!!!!!!!!!!!
- Some stuff # MOAR OUTPUT IS WRONG !!!!!!!!!!!!
- # MOAR OUTPUT IS WRONG !!!!!!!!!!!!
- preamble has 12 chars # MOAR OUTPUT IS WRONG !!!!!!!!!!!!
- ^C
- simula67@hades ~/repos/perl6/7test » perl6-j server.p6
- Listening..
- Some stuff
- Got more stuff END
- preamble has 30 chars
- ^C% simula67@hades ~/repos/perl6/7test » perl6-p server.p6
- Listening..
- Some stuff
- Got more stuff END
- preamble has 30 chars
- ^C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement