I have to connect a Qt4 application to a mono Application. The current proof of concept uses network sockets (which is nice, I can debug using nc
on the command line).
But I am open to new suggestions. What are my alternatives?
Edit:
The original application stack is split into two parts: server + client. The client is supp开发者_Python百科osed to show pictures and videos. Since we found that this is not possible in a sane way in Mono, we split the client into two parts:
server -> client -> GUI
In the original implementation the client+GUI were the same application. Now client is in C# (running on Mono), and the GUI is Qt4. Rewriting the client in Qt4 is not an option.
Right now the communication between the client and the GUI is been done using TCP sockets through localhost. I am looking for better implementations.
Edit2: While the application currently runs on linux, I would like to get this system on windows as well. The client (which has a listening socket...) does work on Win32, and Qt4 is cross platform.
You can:
- Embed Mono in your (presumably C++) Qt 4 app using the Mono embedding API.
- Invert (1) by exposing a C API from your GUI so you can control it from the Mono code using P/Invoke.
- Use a mixture of (1) and (2) - embed Mono, invoke it using embedding API, have it call back using P/Invoke.
- Use other IPC mechanisms such as Unix sockets or shared memory, which might be faster, and would avoid blocking an IP port.
I'd recommend (3).
You can write complete project in C# using Qyoto, you don't write code in 2 diff languages, accessing native api in C# is very complicated task and it takes a lot of time.
You can use Qyoto, which C# bindings for Qt. There is a Qyoto addin for MonoDevelop named 'QyotoDevelop'.
精彩评论