johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
UPdated: it still doesn't seem to work if I add "\n" to the end of commands, and use the Line filter.#!/usr/bin/perl -w # # simple client # use warnings; use strict; use POE; use POE::Component::Client::TCP; use POE::Filter::Stream; my $host = "localhost"; my $port = 38888; POE::Component::Client::TCP->new( RemoteAddress => $host, RemotePort => $port, Filter => "POE::Filter::Stream", Connected => sub { print "connected to $host:$port ...\n"; #now send 10 commands in a row. # is this the right way to send a sequence? foreach my $i(1..10){ $_[HEAP]->{server}->put("command-$i"); } }, ConnectError => sub { print "could not connect to $host:$port ...\n"; }, ServerInput => sub { my ( $kernel, $heap, $input ) = @_[ KERNEL,HEAP, ARG0 ]; print "$input\n"; }, ); POE::Kernel->run(); exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: POE: how to flush io?
by thekestrel (Friar) on Mar 29, 2005 at 23:42 UTC | |
|
Re: POE: how to flush io?
by polettix (Vicar) on Mar 30, 2005 at 10:28 UTC | |
|
Re: POE: how to flush io?
by johnnywang (Priest) on Mar 31, 2005 at 21:13 UTC |