FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE
Ask a question

3844 questions

4379 answers

3252 comments

46074 members

Ask a question
0 votes
865 views
in Vehicle tracking by
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

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.