Last active
August 6, 2021 11:38
-
-
Save percybolmer/66c783eca23e2c885992c67edbb9c562 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
hardwaremonitoring "github.com/percybolmer/grpcstreams/proto" | |
"google.golang.org/grpc" | |
) | |
func main() { | |
fmt.Println("Welcome to streaming HW monitoring") | |
// Setup a tcp connection to port 7777 | |
lis, err := net.Listen("tcp", ":7777") | |
if err != nil { | |
panic(err) | |
} | |
// Create a gRPC server | |
gRPCserver := grpc.NewServer() | |
// Create a server object of the type we created in server.go | |
s := &Server{} | |
// Regiser our server as a gRPC server | |
hardwaremonitoring.RegisterHardwareMonitorServer(gRPCserver, s) | |
log.Println(gRPCserver.Serve(lis)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment