How to make client stub connection timeout c++?

29 views
Skip to first unread message

kang joni

unread,
Nov 17, 2016, 5:56:16 PM11/17/16
to grpc.io
I have this code.

grpc::CreateChannel(host + ":" +port,
                                        grpc
::InsecureChannelCredentials());
grpc
::ClientContext client;
  client
.set_fail_fast(true);

  grpc
::Status stat = stub_->AskService(&client, req, &res);


when user input invalid host, ex: some nonexistent hostname this would hang and not to make timeout.
Any body have pointers ?
thanks

kang joni

unread,
Nov 17, 2016, 6:04:47 PM11/17/16
to grpc.io
solved
context.set_deadline is what I looking for, thanks.
Reply all
Reply to author
Forward
0 new messages