Teltonika TCP listner in Python

Alex
2013-02-06
2013-06-12
  • Alex

    Alex - 2013-02-06

    Hy to all, i'm writing a TCP listner in python for teltonika devices FMXXXX.
    they must be accepted by the server, before send AVL packets… this is my portion of server code which..is working just to receive the imei code…and to send the ack "01", but i cannot receive any AVL data! Where am i wrong?

    thanks in advace

    #!/usr/bin/env python

    import socket

    TCP_IP = '192.168.0.1'       
    TCP_PORT = 45000  
    BUFFER_SIZE = 1024     
    MESSAGE = '01' 

       
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)   
    s.bind((TCP_IP, TCP_PORT))    
       
    while 1:

        s.listen(1)
        conn, addr = s.accept()        
        print ('Connection address:', addr)     
        data = conn.recv(BUFFER_SIZE)    
        #if not data: break
        imei = data.decode("iso-8859-1")
        print ('received data:', imei )

        print ('Sending data to client…')
        msg = MESSAGE.encode('utf-8')
        conn.send(msg)
        print ('Message sended…')

     
  • Alex

    Alex - 2013-02-11

    does anyone can give me a little help ??? ^_^

     
  • Alex

    Alex - 2013-02-18

    i don't know java….i will learn it!  =(
    my main problem is that i cannot send "01" to the device, i'm tryng to encode it in binary as described in the protocol with the command: "msg = MESSAGE.encode('utf-8')"… but nothing!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks