The confusion comes from the name, I think. "Finish" is alerting the system 
that your code is ready to get the status and isn't going to do anything 
more to the stream, but it isn't forcibly shutting down the stream. If you 
want to forcibly shut down the stream, just call a TryCancel on the 
ClientContext object. 

On Wednesday, September 27, 2017 at 11:13:18 PM UTC-7, [email protected] 
wrote:
>
> Hi all,
>
> I am using "A server-side streaming RPC where the client sends a request 
> to the server and gets a stream to read a sequence of messages back. " 
> mode:  
>
> rpc transaction(request) returns (stream response) {}
>
>
> My current Client cod's logic is: if find response message format error, 
> doesn't receive the rest message, call the ClientReader's Finish() function:
>
> while (reader->Read(&response)) {
>       if (response is error) {
> break;
>  }
> }
>
> reader->Finish();
>
>
> The Server's code is simple, just for-loop write all responses:  
>
> for (...) {
>
> writer->Write(response); 
>
> } 
>
>
> But I find if Client doesn't read all responses, the  "reader->Finish();" 
> will block forever. So my current solution is even the response has error, 
> Client still need to 
> read all responses.  
>
> So my question is what is the correct method to only process half of the 
> stream response? Must read all responses? 
>
> Thanks very much in advance!
>
> Best Reagrds
> Nan Xiao
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/efa0ca11-1da7-4c80-a434-0f3742ab96ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to