在 ac 程序和 C++ 之间使用什么 Linux IPC? Qt 应用程序?
我有一个老式的 c 程序,时不时地 需要告诉基于 C++ Qt 的应用程序有关我的系统上发生的一些“事件”。
但是当我开始解决这个问题时,我注意到一些 ipc 技术在 C 程序中非常容易使用。 然后我们有一些在“Qt 世界”中运行良好的 Qt 特定样式, 但它们在 ANSI C 程序中不能很好地工作。
对于在 Qt C++ 和 ac 程序中运行良好且易于使用的 ipc 技术,您有什么建议吗?
谢谢 约翰
I have a old school c program that now and then
need to tell a C++ Qt based application about some "events" that has occurred on my system.
But when I started to work with this problem I noticed that some ipc techniques is quite easy to use in the c program.
And then we have some Qt specific styles that works quite well in the "Qt world",
but they will not work well in the ansi c program.
Do you have any advice on ipc techniques that works well and are easy to use in both a Qt C++ and a c program?
Thanks
Johan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您熟悉网络编程,Unix 域套接字也应该很容易。它们的工作方式有点像双向命名管道,Qt 中的网络 API 应该可以轻松接收作为网络消息传递的“事件”。
If you are familiar with network programming, Unix domain sockets should be easy also. They work kind of like bidirectional named pipes and the network API in Qt should make it easy to receive "events" delivered as network messages.
命名管道怎么样?您可以像操作常规文件一样对它们进行操作(当然创建方式有点不同),我敢打赌旧的 ANSI C 程序和新的 Qt C++ 程序都可以对文件进行操作。
What about named pipes? You can operate on them just like on regular files (creation is a bit different of course), and I bet both old ANSI C programs and new Qt C++ programs can operate on files.
如果事件通知非常简单,那么您可以使用信号。
如果外部来源的通知有用,则可以选择 D-Bus。
If the event notifications are very simple then you could use signals.
If the notification is useful from/to outside sources then D-Bus is an option.