connect(socket, &QTcpSocket::readyRead, this, &ProtectWindow::socketReadySlot); connect(socket, &QTcpSocket::disconnected, this, &ProtectWindow::socketDisconnectSlot); connect(socket, &QTcpSocket::hostFound, this, &ProtectWindow::hostFoundSlot); connect(socket, &QTcpSocket::connected, this, &ProtectWindow::connectedSlot); connect(socket, &QTcpSocket::stateChanged, this, &ProtectWindow::stateChangedSlot);
socket->connectToHost(ipaddress, ipport);
socket->connectToHost(ipStr, ipport);