Created
November 20, 2014 22:19
-
-
Save goloroden/84345b42799b1ac47333 to your computer and use it in GitHub Desktop.
My first Go app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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