I'm writing a socket server in python. It needs to send acknowledgement to the client module. Quote from the protocol description:
"[...]server should determine if it would accept data from this module. If yes server will reply to module 01 if not 00."
I implemented this in python as:
connection.send('01')
It isn't working, so I checked the java implementation of the server:
byte[] answer = {
0x01};
out.write(answer);
out.flush();
I wonder whether it's the same or not? The System.out.write(answer); doesn't seem to output a thing to the console.
1 Answer 1
You're sending two bytes, 0x30 followed by 0x31, whereas the Java code is sending just one byte, 0x01.
Try the following instead:
connection.send('\x01')
In case you're wondering where the 0x30 and 0x31 came from, they are ASCII codes for the characters '0' and '1'.