From 9f130d4f4b8af4afaab7b078a7c4b62b9df57995 Mon Sep 17 00:00:00 2001 From: Nikhil Ikhar Date: Mon, 1 Aug 2022 15:37:23 +0530 Subject: [PATCH] Added greet client 1. added greet client main.go 2. run, make clean; make greet 3. in one tab run, ./bin/greet/server 4. in other tab run, ./bin/greet/client --- greet/client/main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 greet/client/main.go diff --git a/greet/client/main.go b/greet/client/main.go new file mode 100644 index 0000000..5135f59 --- /dev/null +++ b/greet/client/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "log" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +var addr string = "localhost:50051" + +func main() { + conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + log.Fatalf("Failed to create connection: %v\n", err) + } + log.Println("Connected") + defer conn.Close() +}