网络示例

有许多示例展示了 Qt Network 的功能

Qt Network 提供了一套功能全面的网络类,可支持基于客户端和基于服务器的网络编程。

这些示例演示了使用 Qt Network 进行网络编程的基本要点。

Blocking Fortune Client

演示如何为网络服务创建客户端。

Broadcast Receiver

演示如何接收通过本地网络广播的信息。

Broadcast Sender

演示如何向本地网络上的多个客户端广播信息。

DNS lookup

演示如何使用 QDnsLookup 查询主机名。

DTLS client

本示例演示了如何实现客户端 DTLS 连接。

DTLS server

本示例演示了如何实现一个简单的 DTLS 服务器。

Fortune Client

演示如何为网络服务创建客户端。

Fortune Server

演示如何为网络服务创建服务器。

HTTP Client

演示了一个简单的 HTTP 客户端。

Multi-stream Client

演示了如何在客户端使用 SCTP。

Multi-stream Server

演示了如何在服务器端使用 SCTP。

Multicast Receiver

演示如何接收发送到组播组的信息。

Multicast Sender

演示如何向多播组发送消息。

Network Chat

演示了一个有状态的点对点聊天客户端。

Secure Socket Client

演示如何通过加密(SSL)连接进行通信。

Threaded Fortune Server

“多线程 Fortune 服务器”示例展示了如何为一个简单的网络服务创建服务器,该服务器使用线程来处理来自不同客户端的请求。该示例旨在与“Fortune 客户端”示例配合运行。

Torrent Example

演示了复杂的 TCP/IP 操作。

© 2026 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.