]> git.scottworley.com Git - reliable-chat/blobdiff - server/server.go
Optionally specify an address to bind to
[reliable-chat] / server / server.go
index 574d2e1bf27b70dceed64da09cc2fcfa6586b1ac..adbbf8475003123e525047bb101d1730c904adc8 100644 (file)
@@ -27,6 +27,7 @@ import "strconv"
 import "time"
 
 var port = flag.Int("port", 21059, "Port to listen on")
 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")
 
 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));
        })
 
                w.Write([]byte(robots_txt));
        })
 
-       log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*port), nil))
+       log.Fatal(http.ListenAndServe(*localaddress+":"+strconv.Itoa(*port), nil))
 }
 
 func main() {
 }
 
 func main() {