如何连接两个应用程序
我正在考虑用 C++ 构建一个应用程序,它将解析来自网络的文本并创建一些统计结果。我希望将这些结果实时输入到外部应用程序中。然后,外部应用程序(我无法访问其代码,但可以要求付费定制添加)将需要一些代码来读取和使用这些结果。
我想知道在速度和易于实施方面互连这两个应用程序的最佳方式是什么。我在考虑:
disk I/O (slow)
a Windows service
a DLL
a web service
a web page
也许我缺少更好的解决方案?谢谢。
Update : there is an additional need to know how long a data request may take at worst.
I am considering building an app in C++ that will be parsing text from the web and create some statistical results. These results I want to be fed in an external app in real time. The external app (to whose code I have no access, but can ask for a - paid - custom made addition) will then need some code to read and use these results.
I am wondering what would be the best way to interconnect the two apps, in terms of speed and ease of implementation. I am considering :
disk I/O (slow)
a Windows service
a DLL
a web service
a web page
Perhaps I am missing a better solution ? Thank you.
Update : there is an additional need to know how long a data request may take at worst.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
其他应用程序有什么方法来支持接收数据?
What methods does the other application have to support receiving data?
Windows 服务是明智的,但仍然需要与其他应用程序通信,这称为 IPC,描述了 Windows 上的方法 这里,命名管道很简单&灵活,文件映射功能强大。
另一种选择是在中间放置一个数据库?
A windows service would be sensible but would still need to communicate with the other app, this is called IPC, approaches on windows are described here, Named Pipes are simple & flexible, File Mapping is powerfull.
An alternative would be to stick a database in the middle?
有多种 IPC 机制可供选择(套接字、共享内存、管道……)。我想“最佳选择”在很大程度上取决于其他应用程序的结构。您的自定义扩展将花费您多少费用。
我对你的环境不太了解,但可能值得看看 boost.interprocess:
http://www.boost.org/doc/libs/ 1_43_0/doc/html/interprocess.html
There are a number of IPC mechanisms to choose from from (sockets, shared memory, pipes, ...). I guess the "best choice" will depend to a large extend on how the other application is structured aka. how much your custom extension will cost you.
I don't know much of your environment but it might be worthwhile to have a look at boost.interprocess:
http://www.boost.org/doc/libs/1_43_0/doc/html/interprocess.html