1 First, the configuration of pro file: Qt network function needs to add network library to pro file.
2. The method code for establishing 2.QTcpServer server is shown in the following figure.
3. When there is a new client connection, QTcpServer will send out the signal method code of QTcpServer::newConnection.
4. The client is the active connector, and directly establishes the QTcpSocket code without listening.
5. Finally, connect the designated ip and port through connectToHost, and connect the signal of successful socket connection to the corresponding slot. When the connection is successful, the user-defined marker position can be set to true.