Qt Network

The Qt Network module provides a set of APIs for programming applications that use TCP/IP. Operations such as requests, cookies, and sending data over HTTP are handled by various C++ classes.

使用模块

Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake .

构建采用 CMake

使用 find_package() command to locate the needed module component in the Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
					

更多细节,见 构建采用 CMake 概述。

采用 qmake 构建

To configure the module for building with qmake, add the module as a value of the QT variable in the project's .pro file:

QT += network
					

文章和指南

这些文章包含 Qt Network 设置和具有网络能力的应用程序的有关信息。

API 参考

这些是 API 参考材料链接。

Module Evolution

Qt Network 的变化 lists important changes in the module API and functionality that were done for the Qt 6 series of Qt.

许可和归属

Qt Network 在商业许可下是可用的来自 Qt 公司 。此外,它是可用的根据 GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。

Furthermore, Qt Network in Qt 6.5.1 may contain third-party modules under the following permissive licenses:

The Public Suffix List, version a304485800b4b6b796fcccbb3be1585f189ee038, fetched on 2023-05-03 Mozilla 公共许可 2.0
libpsl - C library to handle the Public Suffix List, version 664f3dc85259ec65e30248a61fa1c45b7b0e4c3f BSD 3 条款新 (或修订) 许可

Qt Network can make use of the OpenSSL 工具包 as a back end. The library is then linked against OpenSSL in a way that requires compliance with the OpenSSL 许可 。要允许在 GPL 下链接 OpenSSL 和 Qt Network,下列 GPL 例外情况确实适用:

In addition, as a special exception, the copyright holders listed above give
permission to link the code of its release of Qt with the OpenSSL project's
"OpenSSL" library (or modified versions of the "OpenSSL" library that use the
same license as the original version), and distribute the linked executables.
You must comply with the GNU General Public License version 2 in all
respects for all of the code used other than the "OpenSSL" code.  If you
modify this file, you may extend this exception to your version of the file,
but you are not obligated to do so.  If you do not wish to do so, delete
this exception statement from your version of this file.
					

另请注意:随附 OpenSSL 可能导致 进出口限定 被应用。