Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6098703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:11:18+00:00 2026-05-23T13:11:18+00:00

I use WinInet.h in Delphi to download files over HTTP with the average size

  • 0

I use WinInet.h in Delphi to download files over HTTP with the average size between 30 KB and 1.5 MB.

var
  Buf: array[0..BUFFER_SIZE - 1] of Byte;
while BOOL(InternetReadFile(hUrl, @Buf, SizeOf(Buf), BytesRead)) and (BytesRead > 0) do
 if Terminated then
   Exit
 else
 begin
   FStream.WriteBuffer(Buf, BytesRead);
   Synchronize(UpdateProgress);
   FillChar(Buf, SizeOf(Buf), 0);
 end;

What is the recommended buffer size for such downloads – if shouldn’t be too big neither too small.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:11:19+00:00Added an answer on May 23, 2026 at 1:11 pm

    For such buffers, I usualy code:

    var
      Buf: array[word] of byte;
    

    Which allocates 64 KB of buffer.

    But, from my little experiment, WinINet is so slow that the internal buffer size won’t change much.

    If you look for performance, take a look at WinHTTP, which is much faster than WinINet. More than 10 times faster, at least for multiple connections. Only missing feature is the dialog boxes for remote dial-up access:

    Microsoft Windows HTTP Services (WinHTTP) provides developers with a
    server-supported, high-level interface
    to the HTTP/1.1 Internet protocol.
    WinHTTP is designed to be used
    primarily in server-based scenarios by
    server applications that communicate
    with HTTP servers.

    WinINet was designed as an HTTP client platform for interactive
    desktop applications, such as
    Microsoft Internet Explorer, Microsoft
    Office, and Microsoft Money. WinINet
    displays a user interface for some
    operations such as collecting user
    credentials. WinHTTP, however, handles
    these operations programmatically.
    Server applications that require HTTP
    client services should use WinHTTP
    instead of WinINet. For more
    information, see Porting WinINet
    Applications to WinHTTP.

    WinHTTP is also designed for use in system services and HTTP-based client
    applications. However, single-user
    applications that require FTP protocol
    functionality, cookie persistence,
    caching, automatic credential dialog
    handling, Internet Explorer
    compatibility, or downlevel platform
    support should consider using
    WinINet.

    Extracted from MSDN

    I’ve implemented both WinInet and WinHTTP client access in our Open Source ORM framework. You may take a look at this blog article to find out more info about WinHTTP.

    As far as I know, the latest version of IE uses WinHTTP instead of WinINet. So we may consider going in the same direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i download all directory from server recursively. I use WinINet and this
Use case: user clicks the link on a webpage - boom! load of files
use LWP::Simple; use Parallel::ForkManager; @links=( [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-windows.exe,SweetHome3D-2.1-windows.exe], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-macosx.dmg,SweetHome3D-2.1-macosx.dmg], [http://prdownloads.sourceforge.net/sweethome3d/SweetHome3DViewer-2.1.zip,SweetHome3DViewer-2.1.zip], ); # Max 30 processes for
Someone can give me example how to use SSL with wininet API's ? Here
I have a Visual Studio 2008 C++ application that uses WinInet to retrieve files
I am writing a download file utility using WinINET, and have noticed (especially on
use grep command to find txt files containing telephone number. telephone number format could
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
Use case: A does something on his box and gots stuck. He asks B
Use case: 3rd party application wants to programatically monitor a text file being generated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.