Hello *,
I want to evaluate DCOP IPC mechanisms and wanted to try the DCOPClient::callAsync() method. My server part works well, I can find my async() function e.g. with kdcop, call it, it gets executed, but I can't catch the reply (but the reply is sent: kdcop receives it!).
Here is some code of what I've tried, help will be highly appreciated
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
DCOPClient * client = new DCOPClient();
client->attach();
QCString appID = client->registerAs(CLIENTNAME, false);
client->setNotifications(true);
Stuff * stuff = new Stuff();
int callID = client->callAsync(argv[1], "receiver", "async()", data, stuff, SLOT(theCallBackSlot(int, const QCString&, const QByteArray&) ));
if (callID > 0)
{
printf ("callAsync succeeded with ID=%i\n", callID);
printf ("We are back can do something else\n");
}
else
{
printf ("callAsync failed\n");
}
|
with
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <qobject.h>
#include <qcstring.h>
#include <stdio.h>
class Stuff : public QObject
{
Q_OBJECT
public:
Stuff();
~Stuff();
public slots:
void theCallBackSlot(int callId, const QCString& replyType, const QByteArray &replyData);
};
Stuff::Stuff() : QObject(NULL, NULL)
{}
Stuff::~Stuff()
{}
void Stuff::theCallBackSlot(int callId, const QCString& replyType, const QByteArray &replyData)
{
printf ("CallBackSlot fired for ID:%i\n", callId);
}
|
I think it has to be the registration of the callback function, but I don't know what it is...