Created
February 20, 2017 09:02
-
-
Save anonymous/f5ed77ab667beacb00b74dadbaea1744 to your computer and use it in GitHub Desktop.
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
def check_host_alive(targetServer, port) | |
Timeout::timeout(5) do | |
TCPSocket.new(targetServer, port).close | |
return true | |
end | |
rescue | |
return false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment