In this recipe, we will learn how to create a Transmission Control Protocol (TCP) server in Qt 5. Before we're able to create a server that lets you upload and download files, let's scale it down a bit and learn how to create a networking server that receives and delivers texts.
Creating a TCP server
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:
- After that, go to File | New File or Project again. But this time, select C++ Class under the C++ category, as shown in the following screenshot:
- Then, name your class as server. Set its base class to QObject and make sure the...