Skip to content

Instantly share code, notes, and snippets.

@tony-o
Last active August 29, 2015 14:02
Show Gist options
  • Save tony-o/e9ea977f97175042a66f to your computer and use it in GitHub Desktop.
Save tony-o/e9ea977f97175042a66f to your computer and use it in GitHub Desktop.
my $num = 0;
IO::Socket::Async.listen($.host,$.port,).tap(-> $connection {
my $snum = $num++;
my @chunks;
"connected #$snum".say;
my $tap := $connection.chars_supply.tap({
$_.say;
try {
$connection.send("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 6\r\n\r\nstring");
"closing connection $snum".say if $.debug;
$connection.close;
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment