How to use Signals & Slots to make Inter-Process Communication in Qt ?
-
I want to develop a software constituted of several module, for this, My goal is to communicate in a distance between Modules ( in different computers )
In other way I want to throw signals from Module to another Module and execute the SLOTs in another Module ( communication between signals and slots in distant between applications ( Module of my software) in different computers)
after reading about Inter-Process Communication in Qt,
https://doc.qt.io/qt-5/ipc.html
I realized that the only way to reach my goal is to use the Qt D-bus,
Unfortunately after trying to use it under windows , ( i found it very very hard,)
my questions
is it possible to do what i want to do (use Signals and slots for communication between Modules of my software in distance in different computers ) with another system like ( TCP/IP, QProcess, .. etc , on Qt) ?feedback, Your advice and your ideas are welcome
Thank you for your comments.
-
@Alex42 Signals and slots only work in one process, not across different processes.
But you can use any IPC and implement your own signals/slots on top of it.
For exaple one process sends some data/command to another one and in that process a signal is emitted as soon as this data/command arrives. -
I dont think that is how it works. The signals and slots will only work within the compiled application. You can send data between the processes using IPC and can have signals and slots to manage the communication but they will be contained within the process.
Another option for IPC is Sockets, have a look at the local fortune server example.
-
@Alex42 said in How to use Signals & Slots to make Inter-Process Communication in Qt ?:
feedback, Your advice and your ideas are welcome
Thank you for your comments.Take a look at Qt Remote Objects ==> https://doc.qt.io/qt-5/qtremoteobjects-index.html
Maybe it is what you are looking for. -
@jsulm @DannySW @KroMignon : thank you very much for your comments , i found them very useful ,
Maybe someone among you already use QT DBUS on Windows, I'm Trying to Run dbus daemon on Windows, Unfortunately Without Success,
I already asked this question in another topic but unanswered,https://forum.qt.io/topic/131841/qt-d-bus-error-how-to-use-qt-d-bus-under-windows
-
@Alex42 said in How to use Signals & Slots to make Inter-Process Communication in Qt ?:
Maybe someone among you already use QT DBUS on Windows,
Qt DBus requires DBus, which is not available on Windows. It is a Linux only solution AFAIK. (cf: https://doc.qt.io/qt-5/qtdbus-module.htm)
-
@KroMignon, thank you again ,
I have Qt DBus module properly installed on Windows which is good news. however, for it to properly work i need to have a dbus daemon running on Windows which by default isn't there. Windows doesn't support DBus natively :Yes . But we can use Qt D-Bus under windows
for more information , i let you take a look on these links
https://forum.qt.io/topic/124299/qt-d-bus-on-windowshttps://stackoverflow.com/questions/34342061/specify-dbus-session-address-on-windows
https://stackoverflow.com/questions/29702421/qtdbus-is-not-working-in-qt5-4-1-on-windows-7
-
@artwaw thank you for your answers i see that ,
These are two different questions, the other question it's about how to run dbus-daemon under windows, and here we are talking about signal and slots making inter-Process in Qt
Just to give more information for those who are not familiar with QT D-bus, I attach links with previous communications -
@Alex42 said in How to use Signals & Slots to make Inter-Process Communication in Qt ?:
how to run dbus-daemon under windows
As it has been explained to you, the best solution is to not run. There are some solutions as you can see, but getting them to work is tedious, as you experience it yourself. Should you think of deploying your program to other machines the complexity of process dependencies of your software grows significantly.
I think this is the right moment to rethink your approach and ditch DBus.My personal experience tells me that software made explicitly to leverage *nix systems will never run properly on the different OS architecture (here: POSIX vs Windows). You are most welcome to prove me wrong but I sincerely doubt you'll succeed.
-
@KroMignon D-Bus also works on Windows, but of course one have to build and configure it for Windows.
-
@artwaw thank you for your answers ,
i know, maybe , i can to do what i want to do with TCP/IP, but i need certainly more and more of time to do it ,
I thought that Qt D-Bus will win me time, since we have a lot of class Q D-Bus , who can do the work
Sincerely, it's the loss of not using so many courses on Windows.