开发者

WinhttpReadData slow network

开发者 https://www.devze.com 2023-03-14 00:32 出处:网络
I am downloading an exe from the server using Winhttp C++. I use the sample开发者_StackOverflow code provided in MSDN

I am downloading an exe from the server using Winhttp C++. I use the sample开发者_StackOverflow code provided in MSDN

http://msdn.microsoft.com/en-us/library/aa384104%28v=vs.85%29.aspx

It works fine.I normally used to add up all the data read (Read from WinhttpReadData) and log it.

The expected result is, the added sum should match the exe size. It works fine in reasonably fast network.

In case of very slow network. The data read is too much larger than the original size. But when i check the downloaded exe size, it is same as that of the server.

The logs (which is adding up the data read) shows it reads more data than the original size.

Remember it only occurs in slow network. Have anyone faced this issue?


Are you respecting the value returned via the lpdwNumberOfBytesRead parameter? The number of bytes read with each call may be less than the buffer size you provided -- especially if fewer bytes are available at that time due to the slowness of the network.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号