In QT Creator wrote a program when the receiving end , use a connect (receiver, SIGNAL (readyRead ()), this, SLOT (processPendingDatagram ())); But this cargo did not respond , I see a lot of online search when people say you can use WaitForreadyread () resolved to ask for advice how to use this function ? ? ? ? ?
------ Solution ---------------------------------------- ----
connect successfully did . .
If it fails . When the output window has run output debugging information. .
will explain where in the end failed.
------ Solution ------------------------------------ --------
pServer = new QLocalServer (this);
connect (pServer, SIGNAL (newConnection ()), this, SLOT (rxNewConnection ()));
pServer-> listen (TEST_PROCESS_NAME);
void rxNewConnection ()
{
pSocket = pServer-> nextPendingConnection ();
if (pSocket! = NULL)
{
connect (pSocket, SIGNAL (readyRead ()), this, SLOT (rxMessage ()));
connect (pSocket, SIGNAL (disconnected ()), pSocket, SLOT (deleteLater ()));
}
}
------ eference ----------------------------------- ----
with a bit bool b = connect (receiver, SIGNAL (readyRead ()), this, SLOT (processPendingDatagram ())); however shows b 's value is the true way . . . .
------ eference ------------------------------------ ---
code you have a problem. This signal will certainly trigger . But the question is will trigger multiple times. Therefore, data may be read at a time insufficiency.
------ eference --------------------------------------- < br> I also encountered a similar problem ! ! !
connect (udp, SIGNAL (readyRead ()), this, SLOT (receive_message_slot ()));
slot function I wrote it myself , but it looks like readyRead () This signal has not been emitted ah ! ! !
I gave a udp message
but also bind udp success
is no reaction ah ! ! !
Great God seeking to explain ~ ~ ~
------ eference ------------------------------ ---------
solve the problem , in windows, the system itself requires a wait , but in linux you do not need , so there is no waiting to add the statement section , then under windows is unable to transmit signals the . Currently I understand it this way , if where there are problems, please enlighten our great God . . . . .
没有评论:
发表评论