ZhouYan
2006-02-24 14:57:38 UTC
I upload files to a http server using Winet. But when the 2nd file was
uploading, i got the error ERROR_INTERNET_CONNECTION_ABORTED.
I upload a file by circle:
uReaded = file.size(); // file size
uCount = uReaded / MAX_BLOCK_BUFSIZE;
uTail = uReaded % MAX_BLOCK_BUFSIZE;
inetBuffer.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or
error will occur
inetBuffer.Next = NULL;
inetBuffer.lpcszHeader = NULL;
inetBuffer.dwHeadersLength = 0;
inetBuffer.dwHeadersTotal = 0;
inetBuffer.lpvBuffer = NULL;
inetBuffer.dwBufferLength = 0;
inetBuffer.dwBufferTotal = uReaded; // This is the only member used other
than dwStructSize
inetBuffer.dwOffsetLow = 0;
inetBuffer.dwOffsetHigh = 0;
if (!pFile->SendRequestEx(&inetBuffer, NULL)) // pFile is a CHttpFile
type
return RET_CODE_FAILED;
for (int i = 0; i < uCount; ++i)
{
pFile->Write(pBak, MAX_BLOCK_BUFSIZE); // pBak is the begining of the
file
OnFileUploadRun(MAX_BLOCK_BUFSIZE*(i+1), uReaded); // Notify others.
pBak += MAX_BLOCK_BUFSIZE;
}
if (uTail > 0)
{
pFile->Write(&pBak, uTail);
OnFileUploadRun(uReaded, uReaded);
}
if (pFile->EndRequest()) // end request.
return RET_CODE_SUCCESS;
I found that when the 2nd file uploaded , an error throwed by MFC when
function pFile->Write(***) called. It costs me so many times; who can help
me.
Thanks very much.
uploading, i got the error ERROR_INTERNET_CONNECTION_ABORTED.
I upload a file by circle:
uReaded = file.size(); // file size
uCount = uReaded / MAX_BLOCK_BUFSIZE;
uTail = uReaded % MAX_BLOCK_BUFSIZE;
inetBuffer.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or
error will occur
inetBuffer.Next = NULL;
inetBuffer.lpcszHeader = NULL;
inetBuffer.dwHeadersLength = 0;
inetBuffer.dwHeadersTotal = 0;
inetBuffer.lpvBuffer = NULL;
inetBuffer.dwBufferLength = 0;
inetBuffer.dwBufferTotal = uReaded; // This is the only member used other
than dwStructSize
inetBuffer.dwOffsetLow = 0;
inetBuffer.dwOffsetHigh = 0;
if (!pFile->SendRequestEx(&inetBuffer, NULL)) // pFile is a CHttpFile
type
return RET_CODE_FAILED;
for (int i = 0; i < uCount; ++i)
{
pFile->Write(pBak, MAX_BLOCK_BUFSIZE); // pBak is the begining of the
file
OnFileUploadRun(MAX_BLOCK_BUFSIZE*(i+1), uReaded); // Notify others.
pBak += MAX_BLOCK_BUFSIZE;
}
if (uTail > 0)
{
pFile->Write(&pBak, uTail);
OnFileUploadRun(uReaded, uReaded);
}
if (pFile->EndRequest()) // end request.
return RET_CODE_SUCCESS;
I found that when the 2nd file uploaded , an error throwed by MFC when
function pFile->Write(***) called. It costs me so many times; who can help
me.
Thanks very much.