问题
I am trying to set a data limit when doing connections.I am using the following function to get the size of the NSURLResponse
.
NSURLResponse *response;
long long size = [response expectedContentLength];
I get the size as :15219
Is it in bytes or bits?
回答1:
expectedContentLength
is set when the server provides it, such as by a Content-Length
response header.
Content-Length
is defined by:
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
So you can assume byte unit on most modern platform where a byte is 8 bits long.
来源:https://stackoverflow.com/questions/31387779/what-is-the-unit-of-the-value-returned-by-expectedcontentlength