PDA

View Full Version : Inter-Process Communication : Message Queue ?



lllturtle
18th May 2011, 03:32
hi guys,
i want to figure out about
How to use IPC: message queue in Qt
Does there have any way to do this ?
i'm using Qt 4.7 , and find the page Inter-Process Communication in Qt (http://doc.qt.nokia.com/4.7-snapshot/ipc.html)
there not mention about message queue ,
does that mean current Qt 4.7 not support Message queue to communicate
between Qt process and non-Qt process ?
or there is another way to do ?

any help would be appreciated ,
thanks

high_flyer
19th May 2011, 09:56
there not mention about message queue ,
does that mean current Qt 4.7 not support Message queue to communicate
between Qt process and non-Qt process ?
That is a higher lever construct.
Qt offers you the building blocks to implement such a thing.
You can send and receive messages across processes in any of the ways in the link you posted.
And you have the QEventLoop.
If you wish to use a message loop construct, then you will have to implement it.
You can for example use QEventLoop to handle your messages.
One way would be to pack your incoming messages in to QEvent, and place them in to an event loop of a working thread.

wysota
19th May 2011, 10:01
If you want to use message queues, use the native API (such as msgctl, msgget, msgrcv and msgsnd on Linux) as the concept is not portable across platforms anyway.

lllturtle
25th May 2011, 09:19
finally i use the native API to solve this problem , and it work properly till now
the only thing is i can't compiler under windows now :(
thanks your reply ~

high_flyer
25th May 2011, 09:44
Then implement the windows API equivalent to the code that runs for you on other systems.

jonny.dee
6th August 2011, 13:25
You might want to have a look at ZeroMQ (http://www.zeromq.org/) and the existing Qt binding nzmqt (https://github.com/jonnydee/nzmqt). ZeroMQ is a portable and very efficient message queue. It can bee used for IPC or network communication and is LGPL'ed.