共用方式為


WinInet (HTTP, FTP, Gopher)

OverviewHow Do I

The Microsoft Win32 Internet functions (WinInet) assist you in making the Internet an integral part of any application. The new functions, contained in WININET.DLL, simplify accessing the Internet using HTTP (Hypertext Transfer Protocol), FTP (File Transfer Protocol), and gopher.

Features of WinInet

You can use WinInet to:

  • Download HTML pages.

    HTTP is a protocol used to transfer HTML pages from a server to a client browser.

  • Send FTP requests to upload or download files or get directory listings.

    A typical request is an anonymous logon to download a file.

  • Use gopher's menu system for accessing resources on the Internet.

    Menu items can be several types, including other menus, an indexed database you can search, a newsgroup, or a file.

For all three protocols, you establish a connection, make requests to the server, and close the connection.

Advantages of WinInet

The MFC WinInet classes make it easy to:

  • Read information from HTTP, FTP, and gopher servers as easily as reading files from a hard drive.

  • Use HTTP, FTP, and gopher protocols without programming directly to WinSock or TCP/IP.

    Developers who use the Win32 Internet functions do not need to be familiar with TCP/IP or Windows Sockets. You can still program at the socket level, using WinSock and TCP/IP protocols directly, but it's even easier to use the MFC WinInet classes to access HTTP, FTP, and gopher protocols across the Internet. For many common operations, developers do not need to know the details of the particular protocol they are using.

Many operations that can be performed by your computer as a client to other computers on the Internet can take a long time. The speed of these operations is usually limited by the speed of your network connection, but they can also be affected by other network traffic and the complexity of the operation. Connecting to a remote FTP server, for example, requires that your computer first look up the name of that server to find its address. Your application will then attempt to connect to the server at that address. Once the connection is opened, your computer and the remote server will initiate a conversation with the file transfer protocol before you can actually use the connection to retrieve files.

MFC WinInet Classes

The WinInet support classes are convenient because they do all of this work for you, regardless of what protocol you're using to connect to the remote server. For example, connecting to an FTP server still requires several steps at a low level, but as an MFC developer, you only need to make one call to CInternetSession::GetFTPConnection to create that connection.

As an MFC programmer, you may have used CStdio to manage your data. The new MFC WinInet classes provide the same functionality for data that is transferred across the Internet. These classes abstract the Internet protocols for HTTP, FTP, and gopher into a high-level application programming interface, providing a fast and straightforward path to making applications Internet-aware.

What do you want to do?

What do you want to know more about?

See Also   Internet: Where Is..., ,