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 = "">                 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

With python :

python

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