Slide 59
Slide 59 text
func main() {
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
grpcServer := grpc.NewServer()
pb.RegisterWelcomeServer(grpcServer, newServer())
reflection.Register(grpcServer)
go func() {
log.Printf("start gRPC server port: %v", *port)
grpcServer.Serve(lis)
}()
quit := make(chan os.Signal)
signal.Notify(quit, os.Interrupt)
<-quit
log.Printf("stopping gRPC server...")
grpcServer.GracefulStop()
}
IBUFOBJOUFSO
!"