1 Star 3 Fork 1

feengg / buttonrpc_cpp14

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

buttonrpc - modern rpc framework for C++

  • ZeroMQ 作为网络层
  • 使用c++14开发

Features

  • 轻量级,跨平台,简单易用
  • 服务端可以绑定自由函数,类成员函数,std::function对象
  • 服务端可以绑定参数是任意自定义类型的函数
  • 客户端与服务端自动重连机制
  • 客户端调用超时选项

Example

server:

#include "buttonrpc.hpp"

int foo(int age, int mm){
	return age + mm;
}

int main()
{
	buttonrpc server;
	server.as_server(5555);

	server.bind("foo", foo);
	server.run();

	return 0;
}

client:

#include <iostream>
#include "buttonrpc.hpp"

int main()
{
	buttonrpc client;
	client.as_client("127.0.0.1", 5555);
	int a = client.call<int>("foo", 2, 3).val();
	std::cout << "call foo result: " << a << std::endl;
	system("pause");
	return 0;
}

// output: call foo result: 5

Dependences

Building

  • windows vs2015 或者更高版本, linux 添加编译选项:-std=c++1z

Usage

  • 1: 更多例子在目录 example/ 下

空文件

简介

几百行代码实现的modern c++ rpc library 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/feengg/buttonrpc_cpp14.git
git@gitee.com:feengg/buttonrpc_cpp14.git
feengg
buttonrpc_cpp14
buttonrpc_cpp14
master

搜索帮助