MCPcopy
hub / github.com/grpc/grpc-go / callUnaryEcho

Function callUnaryEcho

examples/features/authentication/client/main.go:39–47  ·  view source on GitHub ↗
(client ecpb.EchoClient, message string)

Source from the content-addressed store, hash-verified

37var addr = flag.String("addr", "localhost:50051", "the address to connect to")
38
39func callUnaryEcho(client ecpb.EchoClient, message string) {
40 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
41 defer cancel()
42 resp, err := client.UnaryEcho(ctx, &ecpb.EchoRequest{Message: message})
43 if err != nil {
44 log.Fatalf("client.UnaryEcho(_) = _, %v: ", err)
45 }
46 fmt.Println("UnaryEcho: ", resp.Message)
47}
48
49func main() {
50 flag.Parse()

Callers 1

mainFunction · 0.70

Calls 3

PrintlnMethod · 0.80
UnaryEchoMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected