呼叫 c/c++来自网络服务器的库
我对网络编程很陌生。我正在开发一个基于 HTML5 的用户界面,该界面应该使用用 C/C++ 编写的中间件。我该怎么做? 我不想使用任何浏览器特定功能/库与中间件进行通信。我们可以在服务器端做同样的事情,然后将信息发送回浏览器吗?如果是这样,我如何实现与服务器端中间件的通信?
预先感谢您的回复。
注意:我计划使用 Tomcat 作为环回服务器。
I am pretty new to web programming.I am developing a HTML5 based user interface which is supposed to use a middle ware written in C/C++.How can I do this?
I do not want to use any browser specific feature/library to communicate with the middle ware. Can we do the same at the server side and then send back the information to the browser? If so how can I achieve this communication with the middle ware at the server side?
Thanks in advance for the reply.
Note : I am planning to use Tomcat as the server in loop back.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如上面所建议的,您可以使用 CGI(例如,perl 脚本)作为 Tomcat 服务器和 C++ 中间件之间的中间人。我还认为可能效果很好,并计划在不久的将来使用自己,那就是使用 boost::asio,并采用示例 HTTP 服务器并修改它以使用您的中间件。然后,您可以使用 AJAX 和 JSON 在 Tomcat 服务器和 C++ 服务器之间进行通信。
As suggested above, you could use CGI (e.g., perl scripts) as a middle-man between the Tomcat server and your C++ middleware. What I also think might work well, and am planning on using myself in the near future, is to use boost::asio, and take the example HTTP server and modify it to use your middleware. You could then communicate between the Tomcat server and the C++ server using AJAX with JSON.
还有一种叫做 pion 服务器 http://www.pion.org/projects/pion- network-library
它允许您用自己的 C++ 编写整个服务器,并抽象出大多数常见任务。
There is also something called pion server http://www.pion.org/projects/pion-network-library
It allows you to write the entire server in your own C++, with most of the common tasks abstracted away.
Wt“web toolkit”库(发音为“witty”)可能会令人感兴趣。本质上,所有网络方面都已处理完毕,因此绝对不需要中间件。以下是引自网站的介绍:
它可以与自己的 Web 服务器一起运行(基于 Boost 组件)或链接针对标准 Web 服务器库。
我写了一篇简短的博客文章,介绍如何将其与我编写的另一个 C++ 组件集成(RInside,它允许将 R 嵌入 C++ 应用程序中)并通过连接两者,我有一个简单的“webapp”,将 R 功能导出到网络。
您可以通过 Javascript 进一步增强它,但我还没有详细研究这一点。
The Wt "web toolkit" library (pronounced "witty") may be of interest. Essentially all web-aspects are taken care of this, so absolutely no middleware. Here is an intro, quoting from the website:
It can run with its own web server (based on a Boost component) or be linked against standard web server libraries.
I wrote a short blog post about how to integrate it with another C++ component I wrote (RInside, which permits to embed R inside C++ apps) and by joining the two, I had a simple 'webapp' exporting R functionality to the web.
You can further enhance it via Javascript but that is something I have not looked into in any detail.