Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to make a very SIMPLE tcp client using POE. The problem is that i recieve the welcome message from the server but then nothing. When i eventually close the client using ctrl + c i recieve all the data that should have been sent when the program is running. this is the code..
#!/usr/bin/perl use strict; use warnings; use POE; use POE::Component::Client::TCP; use POE::Filter::Stream;; my $port = 4853; # The port to connect to. my $host = "someserver"; # The host to test. POE::Component::Client::TCP->new ( RemoteAddress => $host, RemotePort => $port, Filter => "POE::Filter::Stream", Connected => \&on_connect, ServerInput => \&on_recieve, ); sub on_connect { print "connected to $host:$port ...\n"; $_[HEAP]->{server}->put('thepassword'); } sub on_recieve { my ( $kernel, $heap, $input ) = @_[ KERNEL, HEAP, ARG0 ]; print $input; }
any help is appreciated

Replies are listed 'Best First'.
Re: poe tcp client
by matija (Priest) on Jun 12, 2004 at 17:10 UTC
      Thanks very much!!!!, this solved the problem straight away ;-)