Build a grpc c++ client for receiving response from streaming server

30 views
Skip to first unread message

Prashant Shubham

unread,
Aug 31, 2018, 1:25:37 PM8/31/18
to grpc.io
I am trying to build a `grpc` `rpc` which has stream on server side. 
The proto is like

    rpc xyz (abc) return (stream asd){}

How to build a C++ client to keep listening on the stream even after the `rpc` returns response once.

    std::unique_ptr<ClientReader<asd>> reader(stub_->xyz(&context, request));
    while (reader->Read(&reply)) {
        std::cout<<"Response got from server: " << reply.message() << " " << std::endl;
    }

I am able to get reply once but how to keep listening on the same channel even after the response come. I tried introducing `while()` but it closes after raising exception.

The grpc server is written in java.

Mahesh Kanote

unread,
Sep 1, 2018, 9:44:52 AM9/1/18
to Prashant Shubham, grpc.io
If possible can you please share sudo code of java server? Also, is it grpc client to grpc server call or is there any proxy in between? 

--
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+u...@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/db5d777b-bb8c-439d-b7cd-dc8a140a3c5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages