PRB: InternetReadFile May Block Receiving Last Buffer of Data

ID: Q240398


The information in this article applies to:
  • Microsoft Windows CE Operating System, versions 2.0, 2.11


SYMPTOMS

The InternetReadFile Application Programming Interface (API) may block on Windows CE. Usually such behavior occurs while reading the last buffer of data in a loop, using code similar to this (error checking code is omitted):


do
{
     InternetReadFile (..., &dwRead);
}
while (dwRead != 0) 


CAUSE

This problem is caused by using "HTTP/1.1" as the forth parameter (lpszVersion) in HttpOpenRequest API. WinInet on Windows CE version 2.00 and 2.11 supports only HTTP version 1.0.


RESOLUTION

The solution is to use "HTTP/1.0" for lpszVersion parameter or HTTP_VERSION (defined in WININET.H).


STATUS

This behavior is by design.


MORE INFORMATION

When HTTP/1.1 is used, the Web server uses a keep-alive connection and therefore does not close the socket after sending all the data to the client. Because HTTP 1.1 is not supported in WinInet on Windows CE 2.00 and 2.11, InternetReadFile waits to receive FIN from the server (the Transmission Control Protocol [TCP] packet sent by the Web server, indicating connection tear-down) and therefore hangs. After the default timeout, InternetReadFile may return with a timeout error code displayed.

NOTE: Nagling provides a big performance boost in low-bandwidth and high-latency situations (such as many user connections to the Internet). It should not be bypassed lightly.


REFERENCES

For additional information, please click the article numbers below to view the articles in the Microsoft Knowledge Base:

Q238823 BUG: HttpSendRequest Hangs over SSL on WinCE 2.11
Q196586 FIX: HttpSendRequest Does Not Work Correctly on WinCE 2.0

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Leon Braginski, Microsoft Corporation

Additional query words:

Keywords : kbWinCE200 kbWinCE211 kbGrpInetServer kbDSupport
Version : n/a:2.0,2.11
Platform : n/a
Issue type : kbprb


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.