FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

4167 questions

4739 answers

3460 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
948 views
in Vehicle tracking by anonymous
import socket

port = 4000

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

s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

s.bind(('', port))

s.listen(1)

conn, addr = s.accept()

print('Connected by ', addr)

imei = conn.recv(1024)

print("IMEI",imei)

ack = bytes(1)

ack='0x01'

print(ack)

conn.send(ack)

print("Sent ACK",ack)

while True:

    try:

        data = conn.recv(2048)

        if not data:

            break

        print("This is after ACK",data)

    except socket.error:

        print("Error Occured.")

        break

This is my python code.. when i am sending ACK packet('0x01') i am getting not another packet. Can anyone please help.

1 Answer

0 votes
by anonymous

Hello,

Thank you for your query. 

There might be an issue in code. I see that you are following FMB920 protocol. ACK is sent in correct format '0x01'. Have you implemented Codec8/Codec12 completely as well? Can you try to  use Hercules TCP server to make sure device responds to ack packet? You will find information under Codec12 decsription.

You can find information about Codec8/12 - https://wiki.teltonika.lt/view/Codec#Codec_12

Hope this will help.

Best Regards.