This "getBytesLeft()" somehow appears in my mind, no idea where is it from or why. So my thoughts are...
I believe "recv" returns the number of bytes received from the socket connection. Is there such a thing to show bytes that are left to receive or do you implement that yourself (with some headers of data to be sent and calculating with number of bytes returned by the "recv" against that?) ?