Communicate between c++ applications and web applications
What are the various ways I can achieve communication (like function calls) from a web application to a c++ application? I've developed the c++ application to do image processing and want to display and transmit 开发者_如何学运维the result in real time to a web-page displayed on a browser.
Things have changed since this was asked. You can now achieve this type of communication using websockets.
See:
http://en.wikipedia.org/wiki/WebSocket
and
http://www.html5rocks.com/en/tutorials/websockets/basics/
Nothing will 'transmit to a web browser'. Web browsers have to ask, and then you can respond with the data you want to display. As per @The MYYN, you can just have the C++ code drop suitable files and the browser can ask for them. Or, you can set up some sort of webapp.
If you use Ajax you can get the browser to poll for things to show and then show them. It's not a simple architecture.
Flash has XMLSocket, Silverlight has System.Net.Sockets that allows a server to push data to connected clients.
'Nothing will 'transmit to a web browser'. Web browsers have to ask" - spot on.
Maybe you can use a meta refresh tag in the web page header and use from PHP (or JS, etc, if you must) to query the C++ app each time the page reloads?
You have quite limited control about how browsers handle resources in a page, so if you have specific requirements that don't fit you should take control of the resources yourself, e.g. by writing a browser-plugin.
With plugins you can fully control what and when you draw and can freely choose how to communicate between server and client. The obvious draw-back is the increased development effort, you should weigh the benefits against that and possibly take compromises like Flash into account.
精彩评论