O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using UDP

In contrast to TCP, UDP is unreliable and connectionless. Neither the order of packets nor their delivery is guaranteed. These limitations, however, allow UDP to be very fast. So, if you have frequent data, which does not necessarily need to be received by the peer, use UDP. This data could, for example, be real-time positions of a player that get updated frequently or live video/audio streaming. Since QUdpSocket is mostly the same as QTcpSocket—both inherit QAbstractSocket—there is not much to explain. The main difference between them is that TCP is stream-oriented, whereas UDP is datagram-oriented. This means that the data is sent in small packages, containing among the actual content, the sender's as well as the receiver's IP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required