Revision control

Copy as Markdown

// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\page topics-network-connectivity.html
\title Networking and Connectivity
\brief Qt's network and connectivity features.
\ingroup explanations-networkingandconnectivity
Qt provides modules for network communication, web integration,
and device connectivity. You can deploy networked applications
on multiple platforms and devices.
\section1 Communicating over a network with Qt Network
The \l{Qt Network} module provides the main networking APIs in Qt.
Its C++ API allows applications to use the native network
capabilities of the operating system in a safe and efficient way. You can use
Qt for various scenarios, such as sending and receiving data over TCP or UDP
sockets, performing HTTP/HTTPS requests for REST APIs or web services,
downloading and uploading files, handling proxies and authentication, and
establishing secure connections using SSL/TLS.
For more information, see the \l{Network Programming with Qt} overview.
\section1 Accessing resources from QML
QML types can load resources from URLs. The resources can be images, text
files, source files, or other types of files. This can simplify connecting
to different data sources. For more information, see the
\l{Resource Loading and Network Transparency} overview.
You can also use
\l{The XMLHttpRequest JavaScript Object}{XMLHttpRequest} in QML JavaScript
to perform HTTP client functionality, such as submitting form data or loading
data asynchronously from a server.
\section1 Communicating using WebSockets
\l{Qt WebSockets} provides WebSocket functionality to Qt applications.
The WebSocket protocol is for client-server communication that requires
real-time, persistent, and fully asynchronous connections. Compared to
HTTP, WebSocket offers lower latency and higher throughput.
WebSocket uses an HTTP 1.1 GET request for the initial handshake procedure but
the packet format is different.
Applications that benefit from WebSockets include financial market data
feeds and messaging services. For examples, see the
\l{Qt WebSockets Examples} page.
\section1 Running web services
The \l{Qt HTTP Server} module provides classes for developing web services
over a network. Qt HTTP Server supports HTTP/1.1 and HTTP/2 protocols and
provides routing capabilities for creating RESTful APIs.
The \l{Qt OpenAPI} module generates Qt HTTP client code from OpenAPI
specification files. It uses the Qt Network RESTful APIs such as
QRestAccessManager to create type-safe C++ clients for REST services.
\note Qt OpenAPI is in Technology Preview.
\section1 Integrating web content into Qt applications
\l{Qt WebEngine} provides Chromium-based web content rendering with
integration to other Qt modules. You can use Qt WebEngine to embed
Chromium's rendering engine and process web content in your Qt application.
Qt WebEngine supports HTML5, WebGL, and other Chromium features. For a list
of Qt WebEngine features, see the \l{Qt WebEngine Features} page.
\l{Qt WebChannel} can integrate JavaScript content into your Qt
application. Use QWebChannel to expose C++ objects in your
application and use a \l{Qt WebChannel JavaScript API}{JavaScript library} to
access those objects from your web client. Qt objects, properties,
and signals are then accessible from a QWebChannel object in JavaScript. Qt
WebChannel uses WebSockets and works within Qt WebEngine.
\l{Qt WebView} is a lightweight web view that displays web content
in your application. It is based on the platform's native web view.
\section1 Connecting wirelessly with Bluetooth and NFC
Bluetooth is a wireless technology standard for exchanging data over short
distances. Bluetooth is common in consumer devices and newer versions include
Bluetooth Low Energy (BLE) devices with enhanced security measures. With the
\l{Qt Bluetooth} module, you can scan for Bluetooth devices, connect to
devices, and exchange data. Qt Bluetooth supports both Classic and BLE
devices. For more information, see the \l{Qt Bluetooth Overview}.
Near-field communication (NFC) is a short-range wireless technology with a
low data rate and low power usage. NFC is ideal for transferring small packets
of data when two devices are near each other. Use the \l{Qt NFC} module and
its API to establish connectivity between NFC-enabled devices.
\section1 Communicating through serial buses and ports
Qt offers two modules for communicating through serial buses and ports.
\l{Qt Serial Bus} provides an interface to various industrial serial buses and
protocols, such as CAN bus and ModBus. \l{Qt Serial Port} provides an interface
to RS-232 pinouts such as configuration, I/O operations, and control signal
read and write operations.
\section1 Communicating with high-level protocols and services
Several Qt modules are for high-level networked communication and
inter-process communication (IPC). There is also support for Machine-to-Machine
(M2M) industry protocols and for smaller IoT systems. For example, there are Qt
modules for \l{Qt D-Bus}{D-Bus}, \l{Qt GRPC}{gRPC}, \l{Qt MQTT}{MQTT}, and
\l{Qt CoAP}{CoAP}.
For more information, see the \l{Inter-process communication in Qt} page.
\section1 Securing networked applications
For networked and connected devices, be aware of the security considerations.
Implement robust security measures and application design to protect your users,
their data, and your networked systems.
These are some security measures that you can implement:
\list
\li Use encryption when sending or receiving data.
See \l{Secure Sockets Layer (SSL) Classes}.
\li Use strong authentication and authorization mechanisms.
See \l{Qt Network Authorization}.
\li Validate and process untrusted data.
See \l{Handling Untrusted Data}.
\li Set rate limits and monitor traffic to prevent misuse.
\li Incorporate salting or nonce techniques to protect against
monitoring and replay attacks.
\li Update your environment to fix security vulnerabilities.
\endlist
For more information about Qt's security policies and measures, see
\l{Security in Qt}.
*/