From: Scott Worley Date: Thu, 16 Aug 2012 07:19:27 +0000 (-0700) Subject: Optionally specify an address to bind to X-Git-Url: http://git.scottworley.com/reliable-chat/commitdiff_plain/270d2ae5829e1d66dcc1a0fb78ba3c2e3c3c22de?ds=sidebyside Optionally specify an address to bind to --- diff --git a/server/server.go b/server/server.go index 574d2e1..adbbf84 100644 --- a/server/server.go +++ b/server/server.go @@ -27,6 +27,7 @@ import "strconv" import "time" var port = flag.Int("port", 21059, "Port to listen on") +var localaddress = flag.String("localaddress", "", "Local address to bind to") var frame_count = expvar.NewInt("frame_count") var speak_count = expvar.NewInt("speak_count") @@ -203,7 +204,7 @@ func start_server(store Store) { w.Write([]byte(robots_txt)); }) - log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*port), nil)) + log.Fatal(http.ListenAndServe(*localaddress+":"+strconv.Itoa(*port), nil)) } func main() {