Skip to content

Commit

Permalink
Let helloworld example listen to all hosts (#5089)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
thallgren committed Jan 24, 2022
1 parent 9cb4113 commit 5b37682
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/helloworld/greeter_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloRe

func main() {
flag.Parse()
lis, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", *port))
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
Expand Down

0 comments on commit 5b37682

Please sign in to comment.