Jan,

Thanks for the reply. Apologies in delayed acknowledge. You are right. The 
problem was in my asynchronous calls to this particular piece of code. 
The above code works fine. 

Thanks,
Naman

On Thursday, October 6, 2016 at 2:12:40 AM UTC-4, Jan Tattermusch wrote:
>
> Hi,
>
> I skimmed through your code and it looks alright (perhaps I missed 
> something?). What line does throw in your case?
>
> To answer your questions:
>
> The response stream is ready immediately after starting your call and you 
> don't even need to send any requests nor close the request stream to be 
> able to read from responseStream (so your code really should work). 
> Also, if you need to just subscribe for server updates, perhaps the 
> bi-streaming call is an overkill - you could start a server-streaming call, 
> where you send a unary request (with you subscription details) and then 
> keep reading from the response stream (but your example should work).
>
> Jan
>
> On Tue, Oct 4, 2016 at 8:42 PM, <naman....@gmail.com <javascript:>> wrote:
>
>> Hello,
>>
>> I am trying to work on a grpc C# client that initiates a subscription 
>> type call with a grpc server. I believe I sent the subscription correctly 
>> but am not able to read from the response stream correctly. I try to await 
>> on the AsyncEnumerator.MoveNext() task but I get a null reference exception 
>> on the below code.
>>
>> var asyncCall = client.Subscribe();
>> var responseStream = asyncCall.ResponseStream;
>>
>> await asyncCall.RequestStream.CompleteAsync();
>>
>> while (await responseStream.MoveNext())
>> {   
>>     var tresp = asyncCall.ResponseStream.Current;
>>     // print tresp message.
>> }
>>
>> After having sent an RPC call, does the ResponseStream get initialized 
>> immediately ? My guide for this has been 
>> https://github.com/grpc/grpc/blob/v1.0.0/examples/csharp/route_guide/RouteGuideClient/Program.cs
>> .
>>
>> Thanks,
>> Naman
>>
>>
>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to grp...@googlegroups.com 
>> <javascript:>.
>> 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/3c54b44d-bdeb-48c3-a0c3-c804dca2ca87%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/grpc-io/3c54b44d-bdeb-48c3-a0c3-c804dca2ca87%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@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/c5e2fa78-8ab7-40b7-bd3f-7acff880d269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to