Creating a TCP server
In this recipe, we will learn how to create a Transmission Control Protocol (TCP) server in Qt 6. Before we’re able to create a server that lets us upload and download files, let’s scale it down a bit and learn how to create a networking server that receives and delivers texts.
How to do it…
Follow these steps to create a TCP server:
- First, let’s create a Qt Console Application project from File | New File or Project, as shown in the following screenshot:
Figure 7.1 – Creating a new Qt Console Application project
- After that, go to File | New File or Project again but this time, select C++ Class under the C/C++ category, as shown in the following screenshot:
Figure 7.2 – Creating a new C++ class
- Then, name your class
server
. Set its base class to QObject and make sure the Include QObject option is checked before clicking the Next...