#define IN_MILLISECONDS(x) (std::chrono::system_clock::now() + std::chrono::milliseconds(x))
string NowString()
{
char buf[128];
SYSTEMTIME timeBuf;
::GetLocalTime(&timeBuf);
sprintf(buf, "%02d:%02d:%02d.%03d - ", timeBuf.wHour, timeBuf.wMinute, timeBuf.wSecond, timeBuf.wMilliseconds);
return string(buf);
}
void testStub(std::shared_ptr<grpc::Channel> chan)
{
MessageProcessor::Stub client(chan);
Void _void;
AccumulateAmount amount;
amount.set_amount(42);
grpc::ClientContext ctx;
ctx.set_deadline(IN_MILLISECONDS(100));
cout << NowString() << " Making RPC\n";
grpc::Status st = client.Accumulate(&ctx, amount, &_void);
cout << NowString() << " Leaving testStub()\n";
}
void test()
{
auto chan = grpc::CreateChannel("localhost:54321", grpc::InsecureChannelCredentials());
cout << NowString() << " Channel Up- Testing Stub\n";
testStub(chan);
cout << NowString() << " Leaving test()\n";
}
int main()
{
cout << NowString() << "Calling test()\n";
test();
cout << NowString() << "Exiting 'main'\n";
return 1;
}
11:42:05.400 - Calling test()
11:42:05.403 - Channel Up- Testing Stub
11:42:05.404 - Making RPC
11:42:05.506 - Leaving testStub()
11:42:05.507 - Leaving test()
11:42:15.545 - Exiting 'main'
Press any key to continue . . .--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9c7f31b4-ebf0-41e1-958f-e76e661c3471%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/9ab503b5-83d8-471e-b04d-e69a7f864b2d%40googlegroups.com.
21:46:52.966 - main() starting
21:46:52.969 - Channel Up- Testing Stub
21:46:52.969 - Making RPC
21:46:53.071 - Leaving testStub()
21:46:53.073 - Leaving test()
D0530 21:46:54.078000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:46:55.083000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:46:56.086000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:46:57.091000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:46:58.095000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:46:59.099000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:47:00.102000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:47:01.104000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:47:02.107000000 17504 iomgr.c:101] Waiting for 1 iomgr objects to be destroyed
D0530 21:47:03.110000000 17504 iomgr.c:120] Failed to free 1 iomgr objects before shutdown deadline: memory leaks are likely
D0530 21:47:03.111000000 17504 iomgr.c:82] LEAKED OBJECT: client:socket=0x000002699AA021C0 000002699AA02298
21:47:03.110 - main() Exiting
Press any key to continue . . .