is this legal? I can compile but i wonder if this is bad practice or, even worse, suited for run time bugs
connect(mTcpSocket, SIGNAL(connected()), this, SLOT(sendMsg(mTcpSocket)));
connect(pTcpSocket, SIGNAL(connected()), this, SLOT(sendMsg(pTcpSocket)));
...
void ecmqMfgClient
::sendMsg(QTcpSocket *tcpSocket
) {
out << this->Cli2SvrMsg.dutId;
out << this->Cli2SvrMsg.opCode;
out.device()->seek(0);
tcpSocket->write(block);
tcpSocket->waitForBytesWritten();
}
connect(mTcpSocket, SIGNAL(connected()), this, SLOT(sendMsg(mTcpSocket)));
connect(pTcpSocket, SIGNAL(connected()), this, SLOT(sendMsg(pTcpSocket)));
...
void ecmqMfgClient::sendMsg(QTcpSocket *tcpSocket)
{
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_1);
out << this->Cli2SvrMsg.dutId;
out << this->Cli2SvrMsg.opCode;
out.device()->seek(0);
tcpSocket->write(block);
tcpSocket->waitForBytesWritten();
}
To copy to clipboard, switch view to plain text mode
i.e. can i associate to the same signal of two different QTcpSocket to the same slot but with different parameters (the target socket but also others)?
QTcpSocket is event driven so i do not see any danger for concurrency, right?
not sure this is really a newbie question, hope to get less severe reply from somebody ;-)
thanks much
Bookmarks