【发布时间】:2018-03-17 07:25:27
【问题描述】:
我在我的程序中使用grpc::CompletionQueue,您也可以在
“grpc/examples/cpp/helloword/greeter_async_clients.cc”。
问题代码如下!
// stub_->PrepareAsyncSayHello() creates an RPC object, returning
// an instance to store in "call" but does not actually start the RPC
// Because we are using the asynchronous API, we need to hold on to
// the "call" instance in order to get updates on the ongoing RPC.
call->response_reader =
stub_->PrepareAsyncSayHello(&call->context, request, &cq_);
// StartCall initiates the RPC call
call->response_reader->StartCall();
// Request that, upon completion of the RPC, "reply" be updated with the
// server's response; "status" with the indication of whether the operation
// was successful. Tag the request with the memory address of the call object.
call->response_reader->Finish(&call->reply, &call->status, (void*)call);
Client向Server发送1,2,3...100,但是Server得到的号码列表是“100,99,98...2,1”。为什么?我找不到任何有关此的源代码...非常感谢您
并且是用于 gRPC 的 Nagle 算法吗?
【问题讨论】:
标签: asynchronous grpc stub