Since we have created a TCP server in the previous recipe, we now need a client program to complete the project. Therefore, in this recipe, we will learn how to create a TCP client program using Qt 5 and its networking module.
Creating a TCP client
How to do it...
To create a TCP client in Qt 5, let's do the following:
- First off, let's create a new Qt Widgets Application project from Files | New File or Project.
- Once the project has been created, let's open up mainwindow.ui and set up the GUI as shown in the following diagram. Please note that the layout direction of the central widget has to be vertical:
- Then, right-click on the push button that says Connect and create a clicked() slot function from the...