Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

流量大小获取相关问题 #40

Open
li8911255 opened this issue Mar 24, 2017 · 3 comments
Open

流量大小获取相关问题 #40

li8911255 opened this issue Mar 24, 2017 · 3 comments

Comments

@li8911255
Copy link

流量的获取是用的NSURLResponse的 expectedContentLength,但这应该只是在网络正常情况下,请求完全走通后的一个数据,并不能代表实际真实产生的流量吧,请问这个需要怎么获取网络不好,请求走到一半就断了的情况?

@li8911255
Copy link
Author

@coderyi 大神求助啊

@coderyi
Copy link
Owner

coderyi commented Mar 28, 2017

暂时没有时间细看,你如果需要的话,可以看看这个实现满足你吗?https://github.com/1043426357/NetworkFlow-iOS

@Beyond-Chao
Copy link

按照 https://github.com/kasketis/netfox 总的流量应该是 totalRequestSize totalResponseSize 之和,
(Data out + Data in ) , 但如果http开启了压缩比如gzip:Content-Encoding:gzip,这样真真传输的流量大小应该小于客户端收到的,因为session的 dataTask:completionHandler 中拿到的data已经是解压之后的数据了(待确认,没找到相关文档说明具体解压是在网络的哪一层做的),如果这样统计出来的流量大小就是偏大了。不知楼主有何看法?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants