CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: urlfilelenght?

  1. #1
    Join Date
    Aug 2005
    Posts
    140

    Exclamation urlfilelenght?

    is there an api to learn an url's lenght?...

  2. #2
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    Re: urlfilelenght?

    what do you mean by that??
    Mike

  3. #3
    Join Date
    Aug 2005
    Posts
    140

    Exclamation Re: urlfilelenght?

    when i am downloading a web page i want to show the progress.
    so i think i need to knowthe lenght of the target url.

    or is there a function that will show how much of the download progress is bening done???

    ty yours, sincerely.

  4. #4
    Join Date
    Sep 2000
    Location
    Ottawa, Ontario
    Posts
    356

    Re: urlfilelenght?

    If you can see the raw HTTP header then look at the Content-Length: tag. This will be the number of bytes to expect AFTER the header VBCRLF+VBCRLF = header termination.

    Some HTTP headers don't contain this so the only way to know if you received all the bytes is to wait for Connection-Close (socket close) in the latter case it's not possible to calculate the number of bytes you are expecting thus you cannot make a progressbar. This is why some downloads do not show %age complete.

    So check for

    Content-Length: xxxxxx

    at the beginning of the file, then search for the crlfcrlf and count the number of bytes received AFTER this to caculate the progress.

    This is all assuming you have access to raw header data. I didn't see any mention of the method used to download (Web browser control I assume?)

  5. #5
    Join Date
    Aug 2005
    Posts
    140

    Exclamation Re: urlfilelenght?

    ty.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured