Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

all SubConns are in TransientFailure #1

Open
inaxium opened this issue Jun 21, 2019 · 0 comments
Open

all SubConns are in TransientFailure #1

inaxium opened this issue Jun 21, 2019 · 0 comments

Comments

@inaxium
Copy link

inaxium commented Jun 21, 2019

grpcurl -d '{"content": "frank"}' -proto echo-grpc/api/echo.proto -insecure -v 35.204.67.35:443 api.Echo/Echo

Work

package main

import (
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"google.golang.org/grpc/keepalive"
	"log"
	"test_grpc_connect/api"
	"time"
)

func main() {


	var conn *grpc.ClientConn
	conn, err := grpc.Dial("35.204.67.35:443", grpc.WithInsecure(),
		grpc.WithKeepaliveParams(keepalive.ClientParameters{
			Time:                30 * time.Second,
			Timeout:             20 * time.Second,
			PermitWithoutStream: true,
		}))
	if err != nil {
		log.Fatalf("did not connect: %s", err)
	}

	defer conn.Close()

	c := api.NewEchoClient(conn)

	ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second))
	defer cancel()
	r, err := c.Echo(ctx, &api.EchoRequest{Content:"Frank"})
	if err != nil {
		log.Fatalf("could not echo: %v", err)
	}
	log.Printf("Echo: %s", r.Content)
}

Doesn't work.

I try a lot.

I could not find the right solution yet. Maybe you are faster.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant