We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
我发现了这个 https://github.com/vinipsmaker/tufao ,
这是一个迟到的答案..不确定是否有帮助。
I found this https://github.com/vinipsmaker/tufao ,
Its a late answer .. not sure if it helps.
QtWebApp 是一个 HTTP 服务器,支持 GET 和 POST 方法、cookie、会话和文件上传。使用这个库就像编写 Java Servlet 一样简单。
该项目网站是德语的,但可下载的文件都是英文的,包括文档。
QtWebApp is a HTTP server with support of GET and POST method, cookies, sessions and file uploads. Using this library is as simple as writing a Java Servlet.
The project website is in german, however the downloadable files are all in english, including the documentation.
我刚刚发布了 QHttpEngine 的第一个版本,旨在填补您所描述的空白。该项目的目标是提供一组极其简单的类,这些类提供与 Qt 集成的 HTTP 服务器。
例如,要从应用程序中的资源提供静态文件,您需要做的就是:
您还可以创建一个从
QObject
派生的类,将其插槽公开为 HTTP API 中的端点。例如:然后,用户可以将参数编码为 JSON 的 POST 请求发送到
/doSomething
并接收槽生成的响应。整个库都有完整的文档记录,并附带一个相当详尽的测试套件。它是跨平台的,并在 Linux、Windows 和 Mac OS X 上经过正式测试和支持。至少有一个主要的开源应用程序使用 QHttpEngine,NitroShare。
I have just released the first version of QHttpEngine, which aims to fill the gap that you've described. The goal of the project is to provide an extremely simple set of classes that provide an HTTP server that integrates with Qt.
For example, to serve static files from resources in your application, all you would need to do is:
You can also create a class derived from
QObject
that expose its slots as endpoints in an HTTP API. For example:Users can then send a POST request to
/doSomething
with the parameters encoded as JSON and receive the response that the slot generates.The entire library is fully documented and comes with a rather exhaustive test suite. It is cross-platform and is officially tested and supported on Linux, Windows, and Mac OS X. There is at least one major open-source application using QHttpEngine, NitroShare.
这是一个非常简单的 HTTP Web 服务器,自从在 Web 浏览器上建立连接以来,它将每秒更新秒数。
它还在屏幕上显示网络浏览器发送的数据。
该程序设置为使用端口8080
例如127.0.0.1:8080
Here is a very simple HTTP web server that will update the number of seconds, each second, since a connection was made on the web browser.
It also displays the data sent by the web browser on the screen.
The program is set to use port 8080
e.g 127.0.0.1:8080
QttpServer = Qt + libuv + REST = 您的 API 服务器
对于 需要处理大量并发连接的 Qt API 服务器 、请求以及你有什么...我们有 libuv 库。
尽管 libuv 是为 NodeJS 构建的,但 Qt 领域的粉丝仍然可以受益于 epoll 和 kqueues,而不是默认的 select 方法。
在 github 上查看更多内容 https://github.com/supamii/QttpServer
QttpServer = Qt + libuv + REST = your API server
For an Qt API server that need to handle a large number of concurrent connections, request, and what-have-you... we have the libuv library.
Though libuv is built for NodeJS, we fans in Qt-land can still benefit from epolls and kqueues instead of the default select method.
See more on github https://github.com/supamii/QttpServer
QhttpServer 似乎完全符合您的需要。
不幸的是它似乎不是很活跃。
QhttpServer seems to do exactly what you need.
unfortunately it does not seem to be very active.
这是可以从 QML、纯 JS HTTP 处理中使用的简单 Qt 服务器: https://github.com /ncp1402/ql-服务器
Here is simple Qt server that can be used from QML, pure-JS HTTP processing: https://github.com/ncp1402/ql-server
上面的简单服务器在 MSwindows 操作系统上运行时存在问题,因为它会在一段时间后锁定。这是由于 waitForReadyRead() 在 MS 系统上以随机方式运行。 waitForReadyRead() 下面的程序被使用readyRead() 信号的事件循环替换。
The above simple server had issues running on MSwindows operating systems as it would lockup after a while. This was due to waitForReadyRead() operating in a random fashion on MS systems. The program below waitForReadyRead() was replaced with an event loop using readyRead() signal.