After having discussed Qt's high-level network classes such as QNetworkAccessManager and QNetworkConfigurationManager, we will now take a look at lower-level network classes and see how Qt supports you when it comes to implementing TCP or UDP servers and clients. This becomes relevant when you plan to extend your game by including a multiplayer mode. For such a task, Qt offers QTcpSocket, QUdpSocket, and QTcpServer.
Communicating between games
Time for action – Realizing a simple chat program
To get familiar with QTcpServer and QTcpSocket, let's develop a simple chat program. This example will teach you the basic knowledge of network handling in Qt so that you can use this skill later to connect two or more...