Skip to content

n704/go_grpc_eg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GO gRPC Example Square

This example is based on command line tool

Installation

Installing all dependency files are managed by dep package manager

go get -u github.com/golang/dep/cmd/dep
dep ensure

Working

Example I have written uses a server client communication using tcp Client invoke server's service to get result. In this example Server does 2 function

  • Square
    • Return square of number
    • default number is 1
  • Cube
    • Return cube of number
    • default number is 1
go run client/main.go  -square 122 -cube 9
2018/04/26 15:10:54 Square of 122: 14884
2018/04/26 15:10:54 Cube of 9: 729

Runing

For this to work we need to run first run server and client.

Server

go run server/main.go

Client

go run client/main.go