I have a radar and I want to read the UDP packets that are sent by the radar via ethernet port. So I created this script :
import socket
UDP_PORT = 2700
interface=""
sock = socket.socket(socket.AF_INET, # Ethernet
socket.SOCK_DGRAM) # UDP
sock.bind((interface, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data
But when I runt it, I receive strange messages like this:
In the user manual of the radar, it says that the packet consists of the following fields:
- PacketType:(unsigned byte)
- TargetCount: (unsigned byte)
- PacketID: (unsigned int32)
- Reserved: (unsigned byte[32])
- Targets: (RadarTarget[TargetCount]: An array of the detected targets.
How can I read this field from the UDP packet please???
Thank you in advance