From 7719a17648413ee0775d00dedfaf5c94025f798c Mon Sep 17 00:00:00 2001 From: Paul Weil Date: Tue, 21 Apr 2015 12:23:35 -0400 Subject: [PATCH] serve on multiple ports --- examples/hello-openshift/hello_openshift.go | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/examples/hello-openshift/hello_openshift.go b/examples/hello-openshift/hello_openshift.go index 413b8fb5afaa..37e85389627b 100644 --- a/examples/hello-openshift/hello_openshift.go +++ b/examples/hello-openshift/hello_openshift.go @@ -12,9 +12,21 @@ func helloHandler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", helloHandler) - fmt.Println("Started, serving at 8080") - err := http.ListenAndServe(":8080", nil) - if err != nil { - panic("ListenAndServe: " + err.Error()) - } + go func() { + fmt.Println("serving on 8080") + err := http.ListenAndServe(":8080", nil) + if err != nil { + panic("ListenAndServe: " + err.Error()) + } + }() + + + go func() { + fmt.Println("serving on 8888") + err := http.ListenAndServe(":8888", nil) + if err != nil { + panic("ListenAndServe: " + err.Error()) + } + }() + select{} }