I already had a logger in place and I was also seeing logs, there were just no outgoing logs at the 5 minute mark or any time after that, even though I still had a connection open.
For now, I'm manually sending ping messages every 5 minutes on the channel to keep it open, but this should not be necessary as e.g. in Go keep-alive already works. On Monday, July 24, 2017 at 2:21:54 PM UTC+2, Jan Tattermusch wrote: > > Have you tried adding GrpcEnvironment.SetLogger(new ConsoleLogger());? > > Getting gRPC traces in C# is a bit more complicated that it ought to be ( > https://github.com/grpc/grpc/issues/10574) > > On Sat, Jul 22, 2017 at 9:08 PM, <koen.vl...@gmail.com <javascript:>> > wrote: > >> >> 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 grpc-io+u...@googlegroups.com <javascript:>. >> To post to this group, send email to grp...@googlegroups.com >> <javascript:>. >> 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 >> >> <https://groups.google.com/d/msgid/grpc-io/3509b5e5-87d6-4bfd-a8d6-fc3a0446aa99%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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/fe5ca8e3-2680-4491-8fa0-b1428ce2a387%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.