Hexadecimal binary socket transfer

Consider using the techniques shown in clientserial.py, from this thread, keeping the reading thread separate from the state machine that sends commands. The code should work well with a Java socket and a DataInputStream instead of a serial port.