Handle connection lost while data is being sent (C++)

25 views
Skip to first unread message

Rohan Chawhan

unread,
Apr 9, 2019, 8:26:54 AM4/9/19
to grpc.io
Hi all, I want to display a "user defined error" whenever the client-server connection is lost. I reached this blog where a similar issue is shown by printing log. I want to first include this minimum functionality in my client to get notified as soon as the client-to-server connection is broken/unreachable (due to any possible reason).

I could not find any informative resource on this topic for C++. can someone help to handle this connection lost scenario? 

Sidhartha Thota

unread,
Apr 9, 2019, 9:16:00 PM4/9/19
to Rohan Chawhan, grpc.io
Hi,

The below may be useful.

Check channel.GetState() method to check the latest state of channel.


Check below method as well but it is blocking call.

bool WaitForStateChange(grpc_connectivity_state source_state, gpr_timespec deadline);

On Tue, Apr 9, 2019 at 5:26 AM 'Rohan Chawhan' via grpc.io <grp...@googlegroups.com> wrote:
Hi all, I want to display a "user defined error" whenever the client-server connection is lost. I reached this blog where a similar issue is shown by printing log. I want to first include this minimum functionality in my client to get notified as soon as the client-to-server connection is broken/unreachable (due to any possible reason).

I could not find any informative resource on this topic for C++. can someone help to handle this connection lost scenario? 

Matrix Comsec Pvt. Ltd.
#394, GIDC Makarpura - 390010. Dist: Vadodara, Gujarat, India
Matrix Telecom | Security
IP Video Surveillance | People Mobility Management | Unified Communications
1 Million+ Customers | 2,500+ Partners | 60+ Products | 50+ Countries
We put more in the box, so your business can think more out of the box.
Facebooklinkedintwitteryoutube

--
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/fd541245-eccb-4b59-a8e9-c3638fdad4c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks,
Sidhartha Thota.
Reply all
Reply to author
Forward
0 new messages