You are assuming that all 15000 bytes are available all the time.
They won't be.
Instead of "while available read something" you need to "While not enough has been read, then if available read something".
When reading from (assuming) HTTP you first need to read and interpret the headers (the lines before a single blank line). One of these will be the "Content-Length:" header, which will tell you exactly how many bytes are in the body of the response. Then you use that to read the right number of bytes from the body.
So the sequence is:
- Read line by line for the headers interpreting the ones you need to, until:
- You receive a single blank line
- Read the data byte-wise until you have read the number of bytes indicated in the Content-Length header.
If you aren't reading from an HTTP server and you are certain that the data is exactly 15000 bytes in length then you need to skip to point 3 above. Never assume that all the data is there. If there is data then read it, and repeat until you have totalled 15000 bytes.