Qt Network
Qt Network 模块为使用 TCP/IP 的应用程序编程提供了一套 API。请求、cookie 和通过 HTTP 发送数据等操作由各种 C++ 类处理。
使用模块
使用 Qt 模块的 C++ API 需要直接或通过其他依赖关系与模块库链接。有几种构建工具为此提供了专门支持,包括CMake和qmake。
使用 CMake 构建
使用find_package()
命令在Qt6
软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network)
更多详情,请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置使用 qmake 构建的模块,请在项目的 .pro 文件中添加模块作为QT
变量的值:
QT += network
文章和指南
这些文章包含有关Qt Network 设置和具有联网功能的应用程序的信息。
- Qt 网络编程-使用网络功能对应用程序进行编程
- 安全套接字层 (SSL) 类- 通过网络套接字进行安全通信的类
API 参考资料
这些是指向 API 参考资料的链接。
模块演变
Changes toQt Network列出了 Qt 6 系列 Qt 在模块 API 和功能方面所做的重要更改。
许可证和归属
Qt Network Qt 6 是根据Qt 公司的商业许可提供的。此外,它还可以在GNU Lesser General Public License 第 3 版或GNU General Public License 第 2 版下使用。详情请参见Qt Licensing。
此外,Qt 6.9.0 中的Qt Network 可能包含以下许可下的第三方模块:
The Public Suffix List, version 47264b57765919188b9f4144de8d95cf77e1b6dc, fetched on 2025-01-22 | Mozilla 公共许可证 2.0 |
BSD 3 条款 "新 "或 "修订 "许可证 |
Qt Network 可以使用OpenSSL 工具包作为后端。然后,以需要遵守 OpenSSL许可的方式将库与 OpenSSL 链接。为了允许在 GPL 下将 OpenSSL 与 进行链接,以下是 GPL 的例外情况:Qt Network
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 可能会导致进口和出口限制。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.