FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
742 views 0 comments
by anonymous

I have the FMB125 module and want to send a codec 8 stream from a python script.

I can connect to the server but when I send the IMEI I lose the connection

As explained in the Teltonika data transmission/reception protocol guide in the "Communicating with server" section, I need to do the following:

Note The module IMEI is already added to the server, in addition, the module itself can communicate with the server and send data

  1. Module connects to server=> I open a tcp socket  "done succecfully"
  2. Module sends its IMEI.  For example, IMEI 356307042441013 would be sent as 000F333536333037303432343431303133

but when I send the IMEI the server terminates the connection

I am using the folowing code :
 


import socket

HOST = "Server IP" 

PORT =  Port

IMEI="356307042441013"

IMEI=IMEI.encode("iso-8859-1")

IMEI_encoded_bytes='000F333536333037303432343431303133'

server=(HOST,PORT)

client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

client_socket.connect(server)

try:

    

    # Send data

    data_stream_byte=IMEI_encoded_bytes

    data_stream=b'000F333536333037303432343431303133'

    print('sending "%s"' % data_stream)

    client_socket.sendall(data_stream)

    # Look for the response

    data = client_socket.recv(1024)

    print'received "%s"' % data)


 

finally:

    print ('closing socket')

    client_socket.close()

Output:

sending "b'000F333536333037303432343431303133'" received "b''" closing socket

Any help is approciated

1 Answer

0 votes
by anonymous

Hi,

It seems that you're in the wrong forum. Everything related to your device will be answered here: https://community.teltonika-gps.com/

Thank you.

Best regards,

Žygimantas