一般Winhttp问题 [英] General Winhttp Question

查看:84
本文介绍了一般Winhttp问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

使用asynchronize winhttp api时,是否有任何方法可以优化下载线程?这是因为我有并行下载要求的时间预算,而并非所有线程都能在预算范围内.如果我愿意的话,还有哪些选择? 喜欢设计这样的代码?

Are there any ways to proritize the download threads when using asychronize winhttp api? It is because I have a time budget for the parallel download requirement and not all threads can make it within the budget. What are the alternatives if I would like to design the code like that?

我怎么知道我的winhttp请求使用了多少个物理端口/哪些端口?

How can I know how many physical ports/which ports my winhttp request use? 

而且,在关闭所有下载请求后,我正在使用一小段等待时间,以确保它们已正确关闭.这是多余的过程吗?等待的最佳持续时间是多少(目前我将其设置为10ms)?

And also, I am using a small wait after I close all the download request in order to make sure they are closed properly. Is it a redundant procedure? What is the optimal time duration for the wait (currently I set it to 10ms)?

谢谢

科林  

Colin   

推荐答案

使用asynchronize winhttp api时,是否有任何方法可以优化下载线程?这是因为我有并行下载要求的时间预算,而并非所有线程都能在预算范围内.如果我愿意的话,还有哪些选择? 喜欢设计这样的代码?

Are there any ways to proritize the download threads when using asychronize winhttp api? It is because I have a time budget for the parallel download requirement and not all threads can make it within the budget. What are the alternatives if I would like to design the code like that?

您可能需要在此处调整期望值,因为您无法控制远程http服务器的响应时间,这可能是造成任何延迟的最大原因.您可以尝试做的就是尽早提出最长"要求 尽可能.

You may need to adjust your expectations here, as you have no control over the response time of the remote http server, which is likely to be the biggest contribution to any delay.  All you can attempt to do is make the 'longest' request as early as possible.

我怎么知道我的winhttp请求使用了多少个物理端口/哪些端口?

How can I know how many physical ports/which ports my winhttp request use? 

任何特定请求仅使用一个源端口.同一连接上不能有多个未完成的请求,但是您可以打开多个连接(每个连接具有不同的源端口)并同时通过它们发送请求.

Any particular request uses only one source port.  You cannot have more than one request outstanding on the same connection, but you can open multiple connections (each with a distinct source port) and send requests concurrently over them.

而且,在关闭所有下载请求后,我正在使用一小段等待时间,以确保它们已正确关闭.这是多余的过程吗?等待的最佳持续时间是多少(目前我将其设置为10ms)?

And also, I am using a small wait after I close all the download request in order to make sure they are closed properly. Is it a redundant procedure? What is the optimal time duration for the wait (currently I set it to 10ms)?

这可能是多余的,但无害.

It's probably redundant, but harmless.


这篇关于一般Winhttp问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆