When you try to use
HttpSendRequestEx and other associated APIs asynchronously, you need to be aware of the following issues:
- All the normal issues that apply to standard asynchronous WinInet applications also apply when you use HttpSendRequestEx synchronously.
For additional information on how to use WinInet APIs asynchronously, as well as sample code and a list of issues that are common to all asynchronous WinInet applications, click the article number below
to view the article in the Microsoft Knowledge Base:
275046�
SAMPLE: Using AsyncHTTP to Call WinInet APIs Asynchronously
- You will receive the completion for HttpSendRequestEx when all HTTP request headers have been successfully sent.
- You will receive the completion for HttpEndRequest when all HTTP response headers are received from the server.
- You cannot call InternetReadFile(Ex) until you receive a successful completion of HttpEndRequest. Therefore, you must wait until you get an INTERNET_STATUS_REQUEST_COMPLETE notification for HttpEndRequest before you can call InternetReadFile(Ex).
- Even though your request handle has been opened with the asynchronous flag, InternetWriteFile tends to immediately return, indicating that the data has been sent successfully. This is because the operation that sends data across the underlying socket returns as soon as the data has entered the protocol's buffers. This is a very fast operation. Therefore, it completes before InternetWriteFile has a chance to return. However, if you repeatedly call InternetWriteFile too quickly or if you specify a particularly large buffer, you will eventually see it return ERROR_IO_PENDING. Only if you get an ERROR_IO_PENDING return will you receive an INTERNET_STATUS_REQUEST_COMPLETE notification for your call to InternetWriteFile.
The following file is available for download from the Microsoft Download Center:
Release Date: Jan-24-2002
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591�
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
The SendRequestExAsync.exe file contains the following files:
Collapse this tableExpand this table
File name |
---|
SendRequestAsync.cpp |
SendRequestAsync.dsp |