Qt provides classes for both high-level and low-level network communication, classes for web integration, and classes for inter-process communication (IPC).
For high-level network traffic, Qt Network provides an abstraction layer over the operations used, showing only high-level classes and functions. Qt Network can also handle lower level protocols like TCP and UDP. Classes like QTcpSocket and QUdpSocket enable the developer to send and receive messages using the TCP or UDP protocol. Name resolution is done with QHostInfo. QHostInfo is called before creating a network connection with QTcpSocket or QUdpSocket. Filtering and redistributing network traffic via proxies can be handled by the QNetworkProxy class.
Qt provides connectivity options to connect systems or applications using modules like Qt Bluetooth, which provides connectivity between Bluetooth enabled devices. Qt Serial Bus provides classes and functions to access the various industrial serial buses and protocols, and Qt NFC provides connectivity between NFC enabled devices. Also, Qt Serial Port provides the basic functionality, including configuring, I/O operations, and getting and setting the control signals of the RS-232 pinouts.
Qt offers functionalities for Inter-Process Communication. The class QProcess is used to start external programs. Qt D-Bus provides support for D-Bus, an inter-process communication and remote procedure calling mechanism. It communicates via a central server application called a bus. However, it is also possible to let applications communicate directly with each other. QSharedMemory provides access to a shared memory segment by multiple threads and processes. However, a single process can exclusively lock that shared memory.
Qt supports a wide range of network communication, with a focus on HTTP, TCP, and UDP.
At the HTTP level, the Qt Network module offers the network access API, which consists mainly of QNetworkRequest, QNetworkAccessManager, and QNetworkReply. The QNetworkRequest resembles an HTTP request, which gets passed to the QNetworkAccessManager to send the request on the wire; this class returns a QNetworkReply, which enables parsing the HTTP reply. The network access API internally uses the socket classes mentioned below (for TCP and SSL).
QTcpSocket, QUdpSocket, and QSslSocket should be used for communication at the socket level. These classes offer a synchronous API through the waitFor* methods as well as an asynchronous API; if possible (that is if the event loop is running), the asynchronous API should always be preferred. Qt also offers QTcpServer to enable the server-side part of a TCP communication.
For secure communication via SSL, Qt Network offers a wide range of classes alongside the central QSslSocket. For example, QSslCertificate, QSslConfiguration, and QSslError.
Qt also offers HTTP support in QML by either using HTTP explicitly via XmlHttpRequest, or by transparently using HTTP URLs in Image sources for example.
Related Topics:
.proto files.
Qt supports a range of connectivity options, with a focus on Qt Serial Bus, Qt Serial Port, Qt Bluetooth and Qt NFC.
Related Topics: