mirror of
https://github.com/caozhiyi/CppNet.git
synced 2026-01-19 00:05:14 +08:00
24 lines
517 B
C++
24 lines
517 B
C++
#include <iostream>
|
|
#include "Any.h"
|
|
#include "Runnable.h"
|
|
#include "RPCClient.h"
|
|
using namespace std;
|
|
|
|
void Add1CallBack(int code, std::vector<base::CAny>& ret) {
|
|
if (code == NO_ERROR) {
|
|
cout << code << " " << base::any_cast<int>(ret[0]) << endl;
|
|
}
|
|
}
|
|
|
|
Call_back func = Add1CallBack;
|
|
|
|
int main() {
|
|
CRPCClient client;
|
|
client.SetCallBack("Add1", func);
|
|
client.Start(8951, "127.0.0.1");
|
|
for (;;) {
|
|
base::CRunnable::Sleep(1000);
|
|
client.CallFunc("Add1", 100, 200);
|
|
}
|
|
}
|