I've updated the code above.
In reply to Re^3: Chunked unix socket file reading - how? by snoopy in thread Chunked unix socket file reading - how? by Anonymous Monk