Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (20 sloc) 500 Bytes
# A TCP echo client.
# Strawman use cases for Reflex::Stream and Reflex::Connector.
use lib qw(../lib);
package TcpEchoClient;
use Moose;
extends 'Reflex::Client';
sub on_client_connected {
my ($self, $args) = @_;
$self->connection()->put("Hello, world!\n");
sub on_connection_data {
my ($self, $args) = @_;
# Not chomped.
warn "got from server: $args->{data}";
# Disconnect after we receive the echo.
TcpEchoClient->new(port => 12345)->run_all();
Jump to Line
Something went wrong with that request. Please try again.