Skip to content

Instantly share code, notes, and snippets.

@feedbee
Created September 30, 2018 07:27
Show Gist options
  • Save feedbee/35295a76a44405b50a9c3dc6bc7a6dba to your computer and use it in GitHub Desktop.
Save feedbee/35295a76a44405b50a9c3dc6bc7a6dba to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"strconv"
)
func main() {
ports := []int{8080, 8081}
c := make(chan bool)
for _, port := range ports {
go func(p int, c chan bool){
res, err := http.Get("http://:123@192.168.9.2:" + strconv.Itoa(p) + "/requests/status.xml?command=pl_pause")
if err != nil {
panic(err)
}
if res.StatusCode != 200 {
fmt.Println("Status code: ", res.StatusCode)
}
c <- true
}(port, c)
}
for range ports {
<-c
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment