#1 2011-07-04 07:11:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

WinINet vs WinHTTP

In our framework, you can select either TSQLite3HttpClientWinSock, TSQLite3HttpClientWinINet or TSQLite3HttpClientWinHTTP for a HTTP/1.1 client.

Each class has its own architecture, and attach itself to a Windows communication library, all based on WinSock API. As stated by their name, TSQLite3HttpClientWinSock will call directly the WinSock API, TSQLite3HttpClientWinINet will call WinINet API (as used by IE 6) and TSQLite3HttpClientWinHTTP will cal the latest WinHTTP API:
- WinSock is the common user-space API to access the sockets stack of Windows, i.e. IP connection - it's able to handle any IP protocol, including TCP/IP, UDP/IP, and any protocol over it (including HTTP);
- WinINet was designed as an HTTP API client platform that allowed the use of interactive message dialogs such as entering user credentials - it's able to handle HTTP and FTP protocols;
- WinHTTP's API set is geared towards a non-interactive environment allowing for use in service-based applications where no user interaction is required or needed, and is also much faster than WinINet - it only handles HTTP protocol.

HTTPClientAPIs.png

Here are some PROs and CONs of those solutions:

Criteria   WinSock   WinINet   WinHTTP
   API Level   Low   High   Medium
   Local speed   Fastest   Slow   Fast
   Network speed   Slow   Medium   Fast
   Minimum OS   Win95/98   Win95/98   Win2000
   HTTPS   Not available   Available   Available
   Integration with IE   None   Excellent (proxy)   Available (see below)
   User interactivity   None   Excellent (authentication, dial-up)   None

As stated above, there is still a potential performance issue to use the direct TSQLite3HttpClientWinSock class over a network. It has been reported on our forum, and root cause was not identified yet.

Therefore, the TSQLite3HttpClient class maps by default to the TSQLite3HttpClientWinHTTP class. This is the recommended usage from a Delphi client application.

Note that even if WinHTTP does not share by default any proxy settings with Internet Explorer, it can import the current IE settings.  The WinHTTP proxy configuration is set by either proxycfg.exe on Windows XP and Windows Server 2003 or earlier, either netsh.exe on Windows Vista and Windows Server 2008 or later; for instance, you can run "proxycfg -u" or "netsh winhttp import proxy source=ie" to use the current user's proxy settings for Internet Explorer. Under 64 bit Vista/Seven, to configure applications using the 32 bit WinHttp settings, call netsh or proxycfg bits from %SystemRoot%SysWOW64 folder explicitly.

Our SynCrtSock unit provides all necessary classes for access to either WinInet or WinHttp.
See http://synopse.info/fossil/finfo?name=SynCrtSock.pas

Offline

Board footer

Powered by FluxBB