世界最高のc++rpc実装c++14規格に基づく
677 ワード
server:
client:
具体的な実装:https://github.com/button-chen/buttonrpc_cpp14
#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
#include "buttonrpc.hpp"
int main()
{
buttonrpc client;
client.as_client("127.0.0.1", 5555);
int a = client.call("foo", 2, 3);
std::cout << "call foo result: " << a << std::endl;
system("pause");
return 0;
}
// output: call foo result: 5
具体的な実装:https://github.com/button-chen/buttonrpc_cpp14