if (tcpSocketObj->state()==QAbstractSocket::SocketState::ConnectedState) { qDebug() << "send data:"<<dataStr; tcpSocketObj->write(dataStr.toUtf8()); }
if (tcpSocketObj->state() == QAbstractSocket::ConnectedState) { QByteArray data = tcpSocketObj->readAll(); qDebug() << "Received data:" << data; // 在這裡處理接收到的資料 }
######################