Re: [grpc-io] Re: C++ API, unidirectional streaming: How to tell if receiver closed the connection?

2018-11-25 Thread Arthur Wang
I  accidentally worked around the problem by define a bidirectional RPC and
make client periodically sending an acknowledge message among the normal
stream messages to the server , if the server can't give a positive
response to that ack, consider it as shutdown.

On Sun, Nov 25, 2018 at 7:01 PM  wrote:

> This is not a solution for me as the channel is used for others RPC calls,
> having a server cancelling a client stream should not change the channel
> status.
>
> On Friday, November 23, 2018 at 7:07:23 PM UTC+1, men...@gmail.com wrote:
>>
>> I have the same issue look at this:
>> https://github.com/grpc/grpc/issues/17236
>>
>> I have kinda solved (I need to do some further tests) observing the
>> underlying channel status.
>>
>> --
> 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/98d282c1-8511-4499-ba01-f1797e1b99e6%40googlegroups.com
> 
> .
> 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/CAKymdqNi%3DpJ8MD9bPHSyBaH%2Bzh42spas99dE-xDECkHFBCVCtg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: correct way to cancel a streaming connection attempt in c++

2018-11-25 Thread Prashant Shubham
Hi Michael, Were you able to find any other way to cancel the stream from 
client side?

On Tuesday, May 26, 2015 at 9:58:42 PM UTC+5:30, Michael Larson wrote:
>
> a tentative answer to my question:
>
> You can call TryCancel() on the client context from another thread.  I 
> started a "connection monitor" thread just before creating the stream 
> object (the point at which the code would normally hang until the grpc 
> deadline).  With some external synchronization this thread can know whether 
> the stream has received any data within N seconds and call TryCancel() if 
> it hasn't.  I am not using the grpc deadline (it is set to its default, a 
> very long time) and am watching received messages to implement my own 
> timeout while the stream is running.
>
> Please let me know if there is a better or more intended way to do this.
>
> Thanks,
>
> Michael
>
> On Friday, May 22, 2015 at 3:29:55 PM UTC-7, Michael Larson wrote:
>>
>> see this thread for some related discussion (java):
>> https://groups.google.com/forum/#!msg/grpc-io/hahFSzQBN4s/nrifoZ0tATUJ
>>
>> I want to create a bidirectional streaming connection that runs for, say, 
>> 60 seconds, and I'd like to have it fail if it can't connect within 5 
>> seconds, allowing the user to fix connection details or whatever.  If I set 
>> a grpc deadline it has to apply to the entire RPC, so I'd need to set a 
>> timeout of more than 60 seconds to avoid interrupting the normal streaming 
>> duration.  Without a deadline set it will attempt to connect forever.
>>
>> Is there a way to cancel the connection attempt while it's running, 
>> before it has connected?  I ran stub_.reset() from another thread but it 
>> didn't do anything immediately.  grpc_shutdown() seems harmful as it had a 
>> mutex problem later on (and I see this was removed from the examples as no 
>> longer necessary).
>>
>

-- 
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/73eab4e1-0c6e-4b06-ba5e-eab555310be1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: C++ API, unidirectional streaming: How to tell if receiver closed the connection?

2018-11-25 Thread pleuba
This is not a solution for me as the channel is used for others RPC calls, 
having a server cancelling a client stream should not change the channel 
status.

On Friday, November 23, 2018 at 7:07:23 PM UTC+1, men...@gmail.com wrote:
>
> I have the same issue look at this:  
> https://github.com/grpc/grpc/issues/17236
>
> I have kinda solved (I need to do some further tests) observing the 
> underlying channel status.
>
>

-- 
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/98d282c1-8511-4499-ba01-f1797e1b99e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] grpc reconnect

2018-11-25 Thread shafathhusain
hi ,
i have a grpc client program, which reconnects automatically every time 
there is a server restart. I understand grpc has an in build backoff 
algorithm that connects automatically.
But i have a use case where when the server disconnection happens  and the 
when the client connects back to the server i would like to do a replay of 
messages for the client/server to be in sync.

To do that i need to know everytime the server disconnection happens?
is there a way i could do this ?
I am using grpc golang.
conn, err := grpc.Dial(serverIp+":"+ServerPort, timeout, grpc.WithBlock(), 
grpc.WithInsecure())

Any help is really appreciated.

-- 
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/c3f80c74-b886-4102-b6b8-22bb11e0ca68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.