Let helloworld example listen to all hosts (#5089)
This commit changes the address that the helloworld greeter_server is listening to from "localhost:<port>" to just ":<port>", thus enabling the server to be used in setups where the request stem from another host. Signed-off-by: Thomas Hallgren <thomas@tada.se>
This commit is contained in:
@ -47,7 +47,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", *port))
|
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to listen: %v", err)
|
log.Fatalf("failed to listen: %v", err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user