I'm using the gRPC client in C# and using a long-lived duplex stream. 
However, the TCP connection is closed at some time and therefore I would 
like to use a keepalive in the client. The server (written in Go) is 
already configured correctly for the keepalive and already tested with 
clients written in Go.

I use the following code to set a keepalive for 5 minutes and also to 
enable tracing for viewing all incoming/outgoing bytes.

    Environment.SetEnvironmentVariable("GRPC_TRACE", 
"tcp,channel,http,secure_endpoint");
    Environment.SetEnvironmentVariable("GRPC_VERBOSITY", "DEBUG");

    var callCredentials = CallCredentials.FromInterceptor(Interceptor());

    var roots = Encoding.UTF8.GetString(Resources.roots);

    Channel = new Channel(address, ChannelCredentials.Create(new 
SslCredentials(roots), callCredentials), new[]
    {
        new ChannelOption("grpc.keepalive_time_ms", 5 * 60 *  1000), // 5 
minutes
    });

    await Channel.ConnectAsync(DateTime.UtcNow.AddSeconds(5));

However, in the log there are no bytes sent at 5 minutes and the connection 
is closed as I can no longer send/receive messages via the same stream 
after the stream has been idle for some time.

How would I properly enable keepalive?

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/3509b5e5-87d6-4bfd-a8d6-fc3a0446aa99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to