Sha256: 43c8e82b1b5b42e1622a14eb73c4b62220e891c1dca0c01f8d474f2270e2f115
Contents?: true
Size: 321 Bytes
Versions: 108
Compression:
Stored size: 321 Bytes
Contents
require 'timeout' require 'socket' module NetworkConnection def self.connect_to(host, port, timeout=10) Timeout.timeout(timeout) do TCPSocket.new(host, port) end end def self.is_network_available? begin self.connect_to("8.8.8.8", 53, 5) true rescue false end end end
Version data entries
108 entries across 102 versions & 8 rubygems