Hi, Andhi.

Many Internet protocols are line-based and use the RFC "network newline" 
(CR+LF).  POE::Component::Server::TCP defaults to this, but you can change it.  
See: 
http://search.cpan.org/~rcaputo/POE-1.312/lib/POE/Component/Server/TCP.pm#ClientFilter

-- 
Rocco Caputo <rcap...@pobox.com>


On Oct 3, 2011, at 22:49, Andhi Noerdianto wrote:

> Hi, 
> 
> I'm build simple application using POE for receiving data from gps tracker 
> with tcp connection. But i can't receive the data. And then I try write the 
> code into python, and I get the data from tracker. This is my simple code 
> with Perl :
> 
> #!/usr/bin/perl -w
> 
> use warnings;
> use strict;
> use POE qw(Component::Server::TCP);
> 
> 
> POE::Component::Server::TCP->new(
>         Port => 37773,
>         ClientConnected => sub {
>          print "I got a connection from $_[HEAP]{remote_ip}\n";
>         },
>     ClientInput => sub {
>         print "doing something..\n";
>             my ($sender, $heap, $input) = @_[SESSION, HEAP, ARG0];
>             print "RECIEVED: " . $input . "\n";
>         },
> );
> 
> POE::Kernel->run;
> exit;
> 
> And in simple python code :
> 
> import socket
> server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> server_socket.bind(("",37773))
> server_socket.listen(5)
> 
> print "TCPServer Waiting for client on port 37773"
> 
> while 1:
>         client_socket, address = server_socket.accept()
>         print "I got a connection from ", address
>         while 1:
> 
>                 data = client_socket.recv(512)
>                 print "RECIEVED:" , data 
> 
> In the POE code when I run it, just accept that there is a connection from 
> the tracker, but the data does not exist.
> 
> <poe.jpg>
> 
> With python :
> 
> <python.jpg>
> 
> Can you help me about this guys, how I can receive data using POE? Sorry if 
> my english bad.
> 
> Thanks.
> Andhi

Reply via email to