HTTP and FTP Common Functions
Many of the Windows Internet Services (WinInet) functions are used for both HTTP- and FTP-related tasks. These common functions handle tasks consistently, regardless of the protocol they are applied to. For example:
- Downloading files from another computer over the Internet can be handled by the InternetReadFile, InternetFindNextFile, and InternetQueryDataAvailable functions.
- Viewing and changing options are handled by the following functions:
- InternetSetOption accepts an unsigned long integer value that indicates the option to set, a buffer to hold the option setting, and the buffer length.
- InternetQueryOption accepts an unsigned long integer value that indicates the option to query, a buffer to hold the option setting, and a pointer that contains the variable address containing the buffer length.
- The InternetCloseHandle function closes all HINTERNET handles. For more information about Internet handles, see About HINTERNET Handles.
The following table shows the WinInet common (HTTP and FTP) functions. The common functions can be used on different types of HINTERNET handles and during different types of sessions.
Function | Description |
---|---|
InternetFindNextFile | Continues file enumeration or search. Requires a handle created by the FtpFindFirstFile or InternetOpenUrl function. |
InternetLockRequestFile | Allows the user to place a lock on the file that is being used. This function requires a handle returned by the FtpOpenFile, HttpOpenRequest, or InternetOpenUrl function. |
InternetQueryDataAvailable | Retrieves the amount of data available. Requires a handle created by the FtpOpenFile or HttpOpenRequest functions. |
InternetQueryOption | Retrieves the setting of an Internet option. |
InternetReadFile | Reads URL data. Requires a handle created by the InternetOpenUrl, FtpOpenFile, or HttpOpenRequest function. |
InternetSetFilePointer | Sets the position for the next read in a file. Requires a handle created by InternetOpenUrl (on an HTTP URL only) or a handle created by HttpOpenRequest using the GET HTTP verb. |
InternetSetOption | Sets an Internet option. |
InternetSetStatusCallback | Sets a callback function that receives status information. Assigns a callback function to the designated HINTERNET handle and all handles derived from it. |
InternetUnlockRequestFile | Unlocks a file that was locked using the InternetLockRequestFile function. |
Reading files, finding the next file, manipulating options, and setting up asynchronous operations are common to the functions that support various protocols and HINTERNET handle types.
See Also
Windows Internet Services (WinInet)
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.