Creating TCP Server

In this section, we will learn how to create a TCP server that constantly listens to a specific port for incoming messages. For the sake of simplicity, we will just create a global chat room in which every user can see the messages sent by each and every user within the chat room, instead of a one-to-one messaging system with a friend list. You can easily improvise this system to the latter once you have understood how a chat system functions.

First, go to File | New File or Project and choose C++ Class under the C++ category. Then, name the class as server and select QObject as the base class. Make sure the Include QObject option is ticked before proceeding to create the custom class. You should have also noticed the ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.