Python - TCP data format

Viewed 42

I'm trying to receive data from a liscence plate reader in TCP. I connect to the camera, but the message has a strage format

b'\x18\x00\x00\x00@\x9c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\xb36\x00\x00\x0c\x00\x00\x00EC247ZR-FRA\x00\xb06\x00\x00\x0c\x00\x00\x002021-04-15\x00\x00\xb16\x00\x00\x10\x00\x00\x0011-24-15-003\x00\x00\x00\x00'

But it should be : 18 00 00 00 40 9c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 b3 36 00 00 0c 00 00 00 45 43 32 34 37 5a 52 2d 46 52 41 00 b0 36 00 00 0c 00 00 00 32 30 32 31 2d 30 34 2d 31 35 00 00 b1 36 00 00 10 00 00 00 31 30 2d 32 38 2d 33 31 2d 37 32 32 00 00 00 00

import socket, sys

HOST = '192.18.0.10'            #Adresse localhost
PORT = 13000                    #Port d'écoute

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


try:
    mySocket.bind((HOST, PORT))
except socket.error:
    print ("La liaison du socket à l'adresse choisie a échoué.")
sys.exit()



print ("Serveur prêt, en attente de requêtes ...")
mySocket.listen(5)

msgClient = 'This is a string'

while 1 :
    
    connexion, adresse = mySocket.accept()

    msgClient = connexion.recv(1024)
    if msgClient != b'':

        message = msgClient

        print(message)`

Thank you for your help

0 Answers
Related