Basic explanations of wininet, WinHTTP, WinSock, ws2_32

Source: Internet
Author: User

Networking on Windows PlatformsProgramDevelopment, you can use different libraries, but the most common is the database developed by Microsoft. Specifically, there are:

 

(1) WinSock, a development library working at the network layer and transport layer, is suitable for compiling TCP, UDP, and original IP communication programs. The original function is basically in line with the UNIX socket standard. Most programs on Windows platforms, such as QQ and Xunlei, are developed based on them.

 

(2) ws2_32 is an upgraded version of WinSock. Based on its compatibility, ws2_32 is not compliant with the UNIX socket standard, but is more suitable for library functions on Windows platforms, generally starting with WSA.

Most modern Windows platform programs are also dependent on this library.

 

(3) wininet, Windows Internet extension library, working on the application protocol layer, provides the implementation of HTTP, FTP, and Gopher protocols, and provides a basic platform for program development based on the above three protocols, it should be noted that, although wininet works at the application layer, its own wininet. DLL implementation does not depend on Winsock. DLL or ws2_32.dll, but exists independently. At least the current version is like this. The most famous example of wininet-based applications is IE.

 

(4) WinHTTP, which also works on the application protocol layer, provides HTTP implementation. It seems that there are duplicates with wininet. Yes, WinHTTP is designed to replace the HTTP part in wininet. It is more robust and stable, and provides database functions for HTTP server development. For modern HTTP development, we recommend that you use WinHTTP instead of wininet. A famous example of development using WinHTTP is Google's Chrome browser. However, Google gave up WinHTTP in chrome and later versions, but used its own developed HTTP library, this is also an important measure to enable chrome to implement cross-platform. In addition, WinHTTP. dll does not depend on Winsock or ws2_32 and runs independently.

 

If Programming Based on socket, The winows platform and other platform functions are basically the same, it is easier to implement cross-platform.

If you program based on HTTP, the libraries on different platforms are very different. If you do not consider cross-platform WinHTTP, you can consider using libwww for cross-platform programming.

In addition, wsock, wininet, or WinHTTP can also be used at the same time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.