百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rpclib

> 编程语言
开源

rpclib 是一款现代化的 C++ msgpack-RPC 服务器和客户端库

1.8K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

rpclib 是一款现代化的 C++ msgpack-RPC 服务器和客户端库

rpclib

Status

rpclib is looking for maintainers

If you're looking for a similar library with support for JSON-RPC and async operations, check out packio.

Overview

rpclib is a RPC library for C++, providing both a client and server implementation. It is built using modern C++14, and as such, requires a recent compiler. Main highlights:

  • Expose functions of your program to be called via RPC (from any language implementing msgpack-rpc)
  • Call functions through RPC (of programs written in any language)
  • No IDL to learn
  • No code generation step to integrate in your build, just C++

Look&feel

Server

#include <iostream>
#include "rpc/server.h"

void foo() {
    std::cout << "foo was called!" << std::endl;
}

int main(int argc, char *argv[]) {
    // Creating a server that listens on port 8080
    rpc::server srv(8080);

    // Binding the name "foo" to free function foo.
    // note: the signature is automatically captured
    srv.bind("foo", &foo);

    // Binding a lambda function to the name "add".
    srv.bind("add", [](int a, int b) {
        return a + b;
    });

    // Run the server loop.
    srv.run();

    return 0;
}

When srv.run() is called, rpclib starts the server loop which listens to incoming connections and tries to dispatch calls to the bound functions. The functions are called from the thread where run was called from. There is also async_run that spawns worker threads and returns immediately.

Client

#include <iostream>
#include "rpc/client.h"

int main() {
    // Creating a client that connects to the localhost on port 8080
    rpc::client client("127.0.0.1", 8080);

    // Calling a function with paramters and converting the result to int
    auto result = client.call("add", 2, 3).as<int>();
    std::cout << "The result is: " << result << std::endl;
    return 0;
}

Status

All planned 1.0.0 features are done and tested; the current state is production-ready.

Who uses rpclib?

This list is updated as I learn about more people using the library; let me know if you don't want your project listed here.

  • Microsoft AirSim

Thanks

rpclib builds on the efforts of fantastic C++ projects. In no particular order:

  • MessagePack implementation for C and C++ by Takatoshi Kondo (website)
  • asio by Christopher Kohlhoff (website)
  • cppformat (now renamed fmtlib, by Victor Zverovich (website)
  • googletest by Google
  • wheels by Martinho Fernandes

Shoutouts to

  • Appveyor
  • Travis CI
  • Coveralls.io
  • Coverity
  • ASan & TSan helped spotting and resolving many bugs.

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •Expose functions of your program to be called via RPC (from any language
  • •Call functions through RPC (of programs written in any language)
  • •No IDL to learn
  • •No code generation step to integrate in your build, just C++
  • •Microsoft AirSim
  • •MessagePack implementation for C and C++ by Takatoshi Kondo (website)
  • •asio by Christopher Kohlhoff (website)
  • •cppformat (now renamed fmtlib, by Victor Zverovich (website)
  • •googletest by Google
  • •wheels by Martinho Fernandes

> 标签

C++cpluspluscplusplus-14cppcpp14

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言