Skip to content

Instantly share code, notes, and snippets.

@goloroden
Created November 20, 2014 22:19
Show Gist options
  • Save goloroden/84345b42799b1ac47333 to your computer and use it in GitHub Desktop.
Save goloroden/84345b42799b1ac47333 to your computer and use it in GitHub Desktop.
My first Go app
package main
import (
"net"
"os"
"time"
)
func main() {
host := os.Args[1] + ":" + os.Args[2]
for i := 0; i < 60; i++ {
_, err := net.DialTimeout("tcp", host, 2*time.Second)
if err == nil {
os.Exit(0)
}
}
os.Exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment