Comments about the "Starting the File Transfer" section
This is all from memory and i haven't studied this part of the mythtv source in a while.
The "problem" with REQUEST_BLOCK command is that you don't get a reply to the command until the backend have send all the data. So what you have to do is send the REQUEST_BLOCK command, begin reading from the data socket until you get a response to the REQUEST_BLOCK command and then you know how much more data you need to read.
So don't wait for a response to the REQUEST_BLOCK command before starting to read the data. If you do and you requested a lot of data the backend will timeout and complain in the backend log.