呼叫 c/c++来自网络服务器的库

发布于 2024-12-01 14:43:31 字数 197 浏览 0 评论 0原文

我对网络编程很陌生。我正在开发一个基于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

忘东忘西忘不掉你 2024-12-08 14:43:31

正如上面所建议的,您可以使用 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.

愚人国度 2024-12-08 14:43:31

还有一种叫做 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.

醉城メ夜风 2024-12-08 14:43:31

Wt“web toolkit”库(发音为“witty”)可能会令人感兴趣。本质上,所有网络方面都已处理完毕,因此绝对不需要中间件。以下是引自网站的介绍:

API 以小部件为中心,并使用经过良好测试的桌面 GUI 模式
适合网络的开发。对于开发商来说,它提供
特定于 Web 的实现细节的抽象,包括
客户端-服务器协议、事件处理、图形支持、优雅
降级(或渐进增强)和 URL 处理。

与许多基于页面的框架不同,Wt 旨在创建
有状态的应用程序同时具有高度交互性
(充分利用 WebSockets 和 Ajax 等技术)
且可访问(支持纯 HTML 浏览器),使用自动
优雅降级或渐进增强。那些东西
自然而简单的 Wt 需要不切实际的量
其他努力:使用动画切换小部件,同时
通过具有干净 URL 的搜索机器人完美索引,或者具有
持久聊天小部件始终打开,甚至可以在旧版本中使用
Microsoft Internet Explorer 6 等浏览器。

它可以与自己的 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:

The API is widget-centric and uses well-tested patterns of desktop GUI
development tailored to the web. To the developer, it offers
abstraction of web-specific implementation details, including
client-server protocols, event handling, graphics support, graceful
degradation (or progressive enhancement), and URL handling.

Unlike many page-based frameworks, Wt was designed for creating
stateful applications that are at the same time highly interactive
(leveraging techinques such as WebSockets and Ajax to their fullest)
and accessible (supporting plain HTML browsers), using automatic
graceful degradation or progressive enhancement. Things that are
natural and simple with Wt would require an impractical amount of
effort otherwise: switching widgets using animations, while being
perfectly indexed by search robots with clean URLs, or having a
persistent chat widget open throughout, that even works in legacy
browsers like Microsoft Internet Explorer 6.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文