Improve comment
Seperate local error codes from remote error codes
Add error flag injection into stream
Fix bug in determination of cbuffer freespace

We can't actually fit IO_BUFFER_SIZE of data into the buffer.
If you do that, then tail and pos are at the same location,
and you don't know if it is empty or full.