How can i have a control over Server Streaming?

38 views
Skip to first unread message

fofo hi

unread,
Sep 10, 2020, 5:55:16 AM9/10/20
to grpc.io

Hi,
I have a scenario which is described with the following:
gRPC Version is : 1.19.0
i am streaming data from server to client by using API IServerStreamWriter.
On the Client side i am trying to read the streamed data by using IAsyncStreamReader :

while (await call.ResponseStream.MoveNext().ConfigureAwait(false))
{
......
}

Since there are no data streamed from client side, i found that i am not getting out of this loop (client side) as fast as i expected.

First Question : Do i need to set the completeness of the streaming from the server side.
Second Question : Am i able (On the client side) to check that the streaming (ResponseStream) is Completed?
otherwise this Call call.ResponseStream.MoveNext() causes some exception, because this call tries to pick up unavailable data.

Third Question : Is there any possibilities to define some time out for waiting the data on the client side.

I have so far checked what is provided by the API on the server side IServerStreamWriter, and on the client side IAsyncStreamReader, which it doesn't help me to achieve my Goal.
Do i need to get a new upgraded gRPC version, which could help me further?

Thanks a lot for any help.

Best regards
Anas

Mya Pitzeruse

unread,
Sep 10, 2020, 9:36:41 AM9/10/20
to fofo hi, grpc.io
Server streaming calls require a single message to be sent from the client before they start sending response data. If your servers don't 

Q1: Servers control when a server stream ends the same way clients control when the client streams end.
Q2: Clients do know when streams end gracefully or error.
Q3: Most calls have the ability to configure a timeout. It varies between languages, but is often found on the context or call options.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/838a3385-6b08-4d88-a258-8b0467ea6253n%40googlegroups.com.


--

Mya Pitzeruse

Principal Software Engineer - Service Infrastructure

Gender Pronouns: She, Her, Hers

mjp...@indeed.com


Indeed - We help people get jobs.

Indeed.com


Facebook  |  Twitter  |  Instagram

fofo hi

unread,
Sep 10, 2020, 7:26:20 PM9/10/20
to grpc.io
Hallo Mya,
thanks for your answer, actually i did some measurements on the client side, my observation : 
while (await call.ResponseStream.MoveNext().ConfigureAwait(false))  { .... }  
After the client received the last Response Data, the *While loop* will get closed after 2 min or sometimes 10 min.
My Expectation if the client didn't received any streamed data for a defined time period then it has to come out of the while loop.   
therefore i need to be able to get this awaited task **call.ResponseStream.MoveNext().ConfigureAwait(false) **  gracefully closed.
Is there any Way to achieve that?

Thanks very your Help.

Best regards
Anas 

Mya Pitzeruse

unread,
Sep 11, 2020, 9:12:08 AM9/11/20
to fofo hi, grpc.io
From what I can tell it looks like you're using C#. Are you using the C-core implementation or the ASP.NET one?

https://docs.microsoft.com/en-us/aspnet/core/grpc/migration

Reply all
Reply to author
Forward
0 new messages