Thanks a lot for the reply. I have already tried using POE like the way you have suggested. I have used Client Input on the server side and Server Input along with Connected components on the client side. My problem on the Client side is that i am not able to synchronize between sending and receiving files. We do a put ie a send operation in the Connected part and do a receive ie a heap input operation on the Server Input part. But how do we then synchronize if i want to first write a file then read then again write and then read again. This requires some kind of synchronization between Server Input and Connected components reads and writes. I am not sure how to do this. Please help.
#!/usr/bin/perl -w use strict; use POE; use POE::Component::Client::TCP; use POE::Filter::Reference; my $host = "localhost"; # The host to test. my $port = 11212; my @values = (6, 2); POE::Component::Client::TCP->new( RemoteAddress => $host, RemotePort => $port, Filter => "POE::Filter::Reference", Connected => sub { my $j = "teste"; print "connected to $host:$port ...\n"; $_[HEAP]->{server}->put(\@values); }, ConnectError => sub { print "could not connect to $host:$port ...\n"; }, ServerInput => sub { #when the server answer the question my ($kernel, $heap, $input) = @_[KERNEL, HEAP, ARG0]; print "got result from $host:$port ... YAY!\n"; #print to screen the result print $$input. "\n"; }, ); $poe_kernel->run(); exit 0;
In reply to Re^2: POE TCP client problem
by baldeep8
in thread POE TCP client problem
by baldeep8
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |