Not having fully understood the code, quick question about the code. I'm 
interpreting it like this so far:

"contentProgress" is a field that represents a number of so-far received 
characters that gets incremented as the reply is being received. The events 
that update contentProgress trigger a callback stored in "onRecv", which 
returns a boolean that states the answer to the question "Have I finished 
receiving the response?". If n > contentProgress, that means you're still 
waiting for more data and thus the answer is false. Other way around means you 
have received as much as you need, any further data you don't care about, the 
answer is true.

The await in there is somehow receiving the output of "onRecv" and once 
"onRecv"evaluates to true, the await stops waiting and the code continues, 
granting you now have access to the body of the request.

You only want the first n characters of that response-body (since you might not 
have more), so you explicitly substring whatever you received to be only the n 
characters you want.

Am I interpreting the code correctly?

Reply via email to