delphi - Which is the common-average buffer size for InternetReadFile? -
i use wininet.h in delphi download files on http average size between 30 kb , 1.5 mb.
var buf: array[0..buffer_size - 1] of byte; while bool(internetreadfile(hurl, @buf, sizeof(buf), bytesread)) , (bytesread > 0) if terminated exit else begin fstream.writebuffer(buf, bytesread); synchronize(updateprogress); fillchar(buf, sizeof(buf), 0); end; what recommended buffer size such downloads - if shouldn't big neither small.
for such buffers, usualy code:
var buf: array[word] of byte; which allocates 64 kb of buffer.
but, little experiment, wininet slow internal buffer size won't change much.
if performance, take @ winhttp, faster wininet. more 10 times faster, @ least multiple connections. missing feature dialog boxes remote dial-up access:
microsoft windows http services (winhttp) provides developers server-supported, high-level interface http/1.1 internet protocol. winhttp designed used in server-based scenarios server applications communicate http servers.
wininet designed http client platform interactive desktop applications, such microsoft internet explorer, microsoft office, , microsoft money. wininet displays user interface operations such collecting user credentials. winhttp, however, handles these operations programmatically. server applications require http client services should use winhttp instead of wininet. more information, see porting wininet applications winhttp.
winhttp designed use in system services , http-based client applications. however, single-user applications require ftp protocol functionality, cookie persistence, caching, automatic credential dialog handling, internet explorer compatibility, or downlevel platform support should consider using wininet.
extracted msdn
i've implemented both wininet , winhttp client access in our open source orm framework. may take @ blog article find out more info winhttp.
as far know, latest version of ie uses winhttp instead of wininet. may consider going in same direction.
Comments
Post a Comment