Last active
March 5, 2022 16:58
-
-
Save mrnim94/9871063cc7118e0b4b4e98fcc1c6fcb9 to your computer and use it in GitHub Desktop.
client grpc With Insecure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
serverGrpcPort := os.Getenv("HOST_SERVER_NAME")+":"+os.Getenv("PORT_SERVER_NAME") | |
//client connect đến grpc server và ko bảo mật ssl | |
cc, err := grpc.Dial(serverGrpcPort, grpc.WithInsecure()) | |
if err != nil { | |
log.Fatalf("error while create listen %v", err) | |
} | |
//khi sài xong chúng ta cần đóng connection lại | |
defer cc.Close() | |
//tạo client | |
client := calculatorpb.NewCalculatorServiceClient(cc) | |
for { | |
callSum(client) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment