readRequest += chr(startOffset / 256)
readRequest += chr(startOffset % 256)
readRequest += chr(0)
readRequest += chr(2 * nToRead)
sockOutfile.write(readRequest)
Writing binary data to a socket (or file) with Python