1 Star 0 Fork 0

Ticks / SinBack

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

SinBack

一个参考libhv,基于C++11Linux服务端网络库,事件驱动IO, 欢迎使用。


外部依赖库:


使用:

Http服务

#include "Application.h"
#include "base/System.h"
#include "module/http/HttpServer.h"

using namespace SinBack;
using namespace SinBack::Module;

int main(int argc, char* argv[])
{
Base::system_signal(SIGPIPE, nullptr);

auto module = std::make_shared<Http::HttpServer>();
Http::HttpService service;
// 添加 Service
service.GET("/api/test", [](Http::HttpContext& cxt) -> Int {
return cxt.sendText("我是测试接口");
});

module->setting().keepAlive = false;
module->setting().staticFileDir = "../web";
module->addService("main", &service);

Main::Application app;
app.setting().workThreadNum = 4;
app.setting().listenPort = 2022;
app.setting().logPath = "./SinBack";
app.setModule(module);

app.run([](const String& msg){
printf("%s\n", msg.c_str());
});

return 0;
}

TCP服务:

代码结构

----- base : 底层函数封装

----- core : 事件驱动核心代码

----- module : 应用层功能模块

----- tools : 一些工具函数


代码问题请发邮件:tw2938384958@gmail.com2938384958@qq.com

空文件

简介

基于C++11的简单Tcp服务端 展开 收起
C++ 等 3 种语言
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/Ticks_Gitee/SinBack.git
git@gitee.com:Ticks_Gitee/SinBack.git
Ticks_Gitee
SinBack
SinBack
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891