Jump to content
  • Advertisement
Sign in to follow this  
Teric

Calculating the size of a file on a remote server

This topic is 4732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a program to download game content from a remote internet server. I'm using WinINet functions, and they're doing mostly what I need. However, I need to be able to see the full size of a file before downloading it. Is this possible? Currently, I'm using InternetQueryDataAvailable() to determine how much data I can download immediately, but this doesn't return the full size of the file; I need to repeatedly call it until the file is fully downloaded. I'm sure there's a way to query the full data file size before starting a download--can anyone give me a push in the right direction? Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Yeah I just tried that, but it looks like it's assuming that the file in question has an HTTP header with a content-length field. Unfortunately, I'm trying to get a binary file.

Share this post


Link to post
Share on other sites
Quote:
Original post by Teric
Yeah I just tried that, but it looks like it's assuming that the file in question has an HTTP header with a content-length field. Unfortunately, I'm trying to get a binary file.


HTTP doesn't work that way. All files (HTML, text, or binary) downloaded from an HTTP server have an HTTP header. The header is not integrated into the file, its part of the protocol. The only catch, as alluded to, is that a length is not always specified in the header. This is because not all content from an HTTP server will know how big it is when it starts to download (for example non-buffered PHP/ASP pages)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!