SAAT-520Wireless-Communication-Programming-Development-ProtocolI've been trying to send Lowlevel commands to my RFID to get device information. I'm using wireshark to tap the connection and it seams to be fine as packets seem to go and come from my PC to RFID device and vice versa.
But I'm unable to see any response or output on my program. On the device note I have response command, I'm not sure should I and/or where I can use command response.
Import socket
TCP_IP = '192.168.0.238'
TCP_PORT = 7086
BUFFER_SIZE = 20
MESSAGE = '0x55, 0x00~0xFF, 0x01, 0x00, 0x00~0xFF'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((TCP_IP, TCP_PORT))
except:
print ('failed' + TCP_IP, 'down')
s.sendall(MESSAGE)
data = s.recv(BUFFER_SIZE)
s.close()
print 'received', repr(data)
I don't understand why there is no response from my program. No error nor program is successful. Just process never ends.
Also please find the notes for commands in the attachment.
System Information Query Command (0x01H)
Command Response
(From your question)
You are sending data via send, immediately asking for the response data, then closing the socket. Enough time will not have passed for you to get a response. For testing, try placing a time delay between.
You can also wait for the incoming data;
I did personally have an issue if my buffer size was too small -- I had to catch the timeout exception to deal with it. Perhaps try increasing your buffer size.
Below is something close to the actual code I use for my application; It python 3.x, and you will have to condition it a bit -- but it works for me.