Discussion:
InternetReadFile aborts sporadically with error 183
(too old to reply)
Enno Kolb
2004-11-12 14:19:01 UTC
Permalink
Hello,

i'm downloading a XML-file with InternetReadFile (see code snippet below).
With files bigger than arround 20kb InternetReadFile fails sporadically
after it downloaded a few kilobytes of the file successfully. GetLastError
returns 183 (ERROR_ALREADY_EXISTS). My system is running Windows 2000 SP4
with IE 6.0SP1.
What does this error code mean in this context?

Thanks,
Enno

Code spnippet:

#define MAX_STREAMBUFFERSIZE 2048
long FileSize = 0;
CString XMLResponseBuffer;
BYTE StreamBuffer[MAX_STREAMBUFFERSIZE];
ULONG cbToRead = MAX_STREAMBUFFERSIZE;
ULONG cbRead = 0;
do
{
//Datenstrom auslesen
if(InternetReadFile(hRequest, StreamBuffer, cbToRead-1, &cbRead)==FALSE)
{
m_XMLOnlineProtocol->WriteLine("InternetReadFile error : %d",
GetLastError());
m_ErrorFlag = true;
goto READXMLCONTENT_END;
}
StreamBuffer[cbRead] = 0x00;
//Gesamtfilegrösse ermitteln
FileSize += cbRead;
//Buffer in die Datei schreiben
XMLResponseBuffer += StreamBuffer;

} while(cbRead > 0);
Stephen Sulzer
2004-11-13 04:58:41 UTC
Permalink
The problem may involve the WinInet cache. If the cache becomes corrupted or
full it can make WinInet unreliable. Try clearing the cache in Internet
Explorer (delete Temporary Internet files). You may also want to delete the
index.dat hidden file in the Temporary Internet Files\Content.IE5
subdirectory.

Also, to ensure that WinInet does not cache the downloaded file or try to
retrieve the file from the cache, specify the INTERNET_FLAG_NO_CACHE_WRITE
and INTERNET_FLAG_RELOAD flags in the call to HttpOpenRequest (or
InternetOpenUrl).

Hope that helps.

Stephen
Post by Enno Kolb
Hello,
i'm downloading a XML-file with InternetReadFile (see code snippet below).
With files bigger than arround 20kb InternetReadFile fails sporadically
after it downloaded a few kilobytes of the file successfully. GetLastError
returns 183 (ERROR_ALREADY_EXISTS). My system is running Windows 2000 SP4
with IE 6.0SP1.
What does this error code mean in this context?
Thanks,
Enno
#define MAX_STREAMBUFFERSIZE 2048
long FileSize = 0;
CString XMLResponseBuffer;
BYTE StreamBuffer[MAX_STREAMBUFFERSIZE];
ULONG cbToRead = MAX_STREAMBUFFERSIZE;
ULONG cbRead = 0;
do
{
//Datenstrom auslesen
if(InternetReadFile(hRequest, StreamBuffer, cbToRead-1,
&cbRead)==FALSE)
Post by Enno Kolb
{
m_XMLOnlineProtocol->WriteLine("InternetReadFile error : %d",
GetLastError());
m_ErrorFlag = true;
goto READXMLCONTENT_END;
}
StreamBuffer[cbRead] = 0x00;
//Gesamtfilegrösse ermitteln
FileSize += cbRead;
//Buffer in die Datei schreiben
XMLResponseBuffer += StreamBuffer;
} while(cbRead > 0);
Enno Kolb
2004-11-16 12:17:05 UTC
Permalink
Thx, i'll try this.
Post by Stephen Sulzer
The problem may involve the WinInet cache. If the cache becomes corrupted or
full it can make WinInet unreliable. Try clearing the cache in Internet
Explorer (delete Temporary Internet files). You may also want to delete the
index.dat hidden file in the Temporary Internet Files\Content.IE5
subdirectory.
Also, to ensure that WinInet does not cache the downloaded file or try to
retrieve the file from the cache, specify the INTERNET_FLAG_NO_CACHE_WRITE
and INTERNET_FLAG_RELOAD flags in the call to HttpOpenRequest (or
InternetOpenUrl).
Hope that helps.
Stephen
Post by Enno Kolb
Hello,
i'm downloading a XML-file with InternetReadFile (see code snippet below).
With files bigger than arround 20kb InternetReadFile fails sporadically
after it downloaded a few kilobytes of the file successfully. GetLastError
returns 183 (ERROR_ALREADY_EXISTS). My system is running Windows 2000 SP4
with IE 6.0SP1.
What does this error code mean in this context?
Thanks,
Enno
#define MAX_STREAMBUFFERSIZE 2048
long FileSize = 0;
CString XMLResponseBuffer;
BYTE StreamBuffer[MAX_STREAMBUFFERSIZE];
ULONG cbToRead = MAX_STREAMBUFFERSIZE;
ULONG cbRead = 0;
do
{
//Datenstrom auslesen
if(InternetReadFile(hRequest, StreamBuffer, cbToRead-1,
&cbRead)==FALSE)
Post by Enno Kolb
{
m_XMLOnlineProtocol->WriteLine("InternetReadFile error : %d",
GetLastError());
m_ErrorFlag = true;
goto READXMLCONTENT_END;
}
StreamBuffer[cbRead] = 0x00;
//Gesamtfilegrösse ermitteln
FileSize += cbRead;
//Buffer in die Datei schreiben
XMLResponseBuffer += StreamBuffer;
} while(cbRead > 0);
Loading...