Networking and Connectivity | Qt 6.12
Description: Qt's network and connectivity features.

- Qt 6.12
- All Overviews
- Networking and Connectivity
- Qt 6.12.0 Reference Documentation

Desktop Integration ◦ Inter-process communication

# Networking and Connectivity

Qt provides modules for network communication, web integration, and device connectivity. You can deploy networked applications on multiple platforms and devices.

## Communicating over a network with Qt Network

The 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 Network Programming with Qt overview.

## 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 Resource Loading and Network Transparency overview.

You can also use XMLHttpRequest in QML JavaScript to perform HTTP client functionality, such as submitting form data or loading data asynchronously from a server.

## Communicating using WebSockets

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 Qt WebSockets Examples page.

## Running web services

The 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 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.

## Integrating web content into Qt applications

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 Qt WebEngine Features page.

Qt WebChannel can integrate JavaScript content into your Qt application. Use QWebChannel to expose C++ objects in your application and use a 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.

Qt WebView is a lightweight web view that displays web content in your application. It is based on the platform's native web view.

## 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 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 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 Qt NFC module and its API to establish connectivity between NFC-enabled devices.

## Communicating through serial buses and ports

Qt offers two modules for communicating through serial buses and ports. Qt Serial Bus provides an interface to various industrial serial buses and protocols, such as CAN bus and ModBus. Qt Serial Port provides an interface to RS-232 pinouts such as configuration, I/O operations, and control signal read and write operations.

## 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 D-Bus, gRPC, MQTT, and CoAP.

For more information, see the Inter-process communication in Qt page.

## 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:

- Use encryption when sending or receiving data. See Secure Sockets Layer (SSL) Classes.
- Use strong authentication and authorization mechanisms. See Qt Network Authorization.
- Validate and process untrusted data. See Handling Untrusted Data.
- Set rate limits and monitor traffic to prevent misuse.
- Incorporate salting or nonce techniques to protect against monitoring and replay attacks.
- Update your environment to fix security vulnerabilities.

For more information about Qt's security policies and measures, see Security in Qt.

Desktop Integration ◦ Inter-process communication