轻量级 http 服务器 C++
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4161257/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
lightweight http server C++
提问by Andrei Lopatenko
I need to build a lightweight http server for my application basically it's a server which listen to a port and outputs a status information on requests no high load, https, other functionality is required is there any C++ library which would help me to build an http server
我需要为我的应用程序构建一个轻量级的 http 服务器,基本上它是一个服务器,它侦听一个端口并输出关于请求的状态信息,没有高负载,https,需要其他功能是否有任何 C++ 库可以帮助我构建一个 http服务器
回答by Gui Prá
Have a look at http://code.google.com/p/mongoose/. I think it's separated in a library that does exactly what you want. It's written in C, though.
看看http://code.google.com/p/mongoose/。我认为它在一个库中分开,完全符合你的要求。不过,它是用 C 编写的。
回答by Piotr
Mongoose has now a C++ wrapper - see:
Mongoose 现在有一个 C++ 包装器 - 请参阅:
回答by t.g.
how about these boost.asio examples, you got 5 choices as of version 1.44. or you may try cpp-netlib, which is built on boost.asio and meant to be included in boost.
这些boost.asio 示例怎么样,从 1.44 版开始,您有 5 个选择。或者您可以尝试cpp-netlib,它建立在 boost.asio 上并打算包含在boost 中。
回答by Akshay Patil
Here is another light weight server which can be used along c++ .
这是另一个可以与 c++ 一起使用的轻量级服务器。
http://sourceforge.net/projects/miniweb/see , what features match your requirement.
http://sourceforge.net/projects/miniweb/查看,哪些功能符合您的要求。
回答by smilingthax
There is libmicrohttpd. I had to write quite some glue code to make it fit my purpose, though; but I never regretted.
有libmicrohttpd。不过,我必须编写相当多的胶水代码才能使其符合我的目的;但我从不后悔。
回答by hfingler
Everything is there (c++ standard)... sockets, read/write if TCP, and other functions for UDP (if you will use it), etc... There's nothing else you'll need but networking functions, the rest is up to file managing (reading html files and such) and threading if you wanna go further.
一切都在那里(C++ 标准)...套接字,TCP 读/写,以及 UDP 的其他功能(如果你会使用它)等等......除了网络功能之外你不需要其他任何东西,剩下的就完成了文件管理(读取 html 文件等)和线程,如果你想更进一步。
I REALLY advice you to read this guide:
我真的建议您阅读本指南:
It's free and it explains everything you need to implement that little web server.
它是免费的,它解释了实现那个小型 Web 服务器所需的一切。
I'm supposing this is an assignment, i didn't get this on my networking classes, but some friends did, and it's pretty easy and fun to do if you have some little c++ knowledge.
我假设这是一个作业,我没有在我的网络课程中得到这个,但一些朋友做了,如果你有一些 C++ 知识,这很容易和有趣。