detect client disconnect C++

357 views
Skip to first unread message

Chaitanya Gangwar

unread,
Aug 17, 2016, 5:51:32 AM8/17/16
to grpc.io
Hi,

I have Async streaming server implemented in C++.
I want to know is there any way to detect on server side when a client disconnects so that i can clean up the resources.

Currently i am relying on "m_serverContext->IsCancelled ()" but i need to periodically check this if the client is present or gone. I am thinking of some event or notification received at server side when client disconnects so that i don't need to periodically checks the "m_serverContext->IsCancelled ()".

Thanks
Chaitanya

Yang Gao

unread,
Aug 17, 2016, 1:35:53 PM8/17/16
to Chaitanya Gangwar, grpc.io
You may want to try ServerContext::AsyncNotifyWhenDone.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/578be824-2c0e-49dd-bef9-b740f84c231f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chaitanya Gangwar

unread,
Aug 23, 2016, 3:09:06 AM8/23/16
to grpc.io, chaitany...@gmail.com
Thanks Yang, It worked fine.


On Wednesday, 17 August 2016 23:05:53 UTC+5:30, Yang Gao wrote:
You may want to try ServerContext::AsyncNotifyWhenDone.
On Wed, Aug 17, 2016 at 2:51 AM, Chaitanya Gangwar <chaitany...@gmail.com> wrote:
Hi,

I have Async streaming server implemented in C++.
I want to know is there any way to detect on server side when a client disconnects so that i can clean up the resources.

Currently i am relying on "m_serverContext->IsCancelled ()" but i need to periodically check this if the client is present or gone. I am thinking of some event or notification received at server side when client disconnects so that i don't need to periodically checks the "m_serverContext->IsCancelled ()".

Thanks
Chaitanya

--
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.
Reply all
Reply to author
Forward
0 new messages