What is the unit of the value returned by “expectedContentLength”

a 夏天 提交于 2019-12-13 04:34:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!