MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / main

Function main

src/examples/tcpsocketclient.cpp:16–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace std;
15
16int main(int argc, char **argv) {
17 string host;
18 unsigned int port;
19
20 if (argc == 3) {
21 host = string(argv[1]);
22 port = atoi(argv[2]);
23 } else {
24 host = "127.0.0.1";
25 port = 6543;
26 }
27
28 cout << "Params are :" << endl;
29 cout << "\t host: " << host << endl;
30 cout << "\t port: " << port << endl;
31
32 TcpSocketClient client(host, port);
33 Client c(client);
34
35 Json::Value params;
36 params["name"] = "Peter";
37
38 try {
39 cout << c.CallMethod("sayHello", params) << endl;
40 } catch (JsonRpcException &e) {
41 cerr << e.what() << endl;
42 }
43}

Callers

nothing calls this directly

Calls 3

stringClass · 0.85
CallMethodMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected