CFNetwork HTTP 超时?
我正在寻找一种为 CFHTTP 请求添加超时的方法。 似乎应该有 CFHTTPMessage
或 CFReadStream
对象的功能,但我找不到它。 我是否必须在运行循环上滚动自己的计时器或其他东西? (如果是这样,有任何代码吗?)
谢谢!
I am looking for a way to add a timeout to a CFHTTP request. It seems like there should be a feature of the CFHTTPMessage
or the CFReadStream
object, but I can't find it. Do I have to roll my own timer on the run loop or something? (if so, any code for this?)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个,readStream是你的CFReadStreamRef:
写入超时常量是_kCFStreamPropertyWriteTimeout
Try this, readStream is your CFReadStreamRef:
Constant for write timeout is _kCFStreamPropertyWriteTimeout
我的答案已过时,但我无法删除已接受的答案。
My answer is outdated but I can't delete the accepted answer.