Method: MCQuery.key

Defined in:
lib/query/query.rb

.keyObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/query/query.rb', line 12

def self.key
    begin
        Timeout.timeout(1) do
            start = @sock.send("\xFE\xFD\x09\x01\x02\x03\x04".force_encoding(Encoding::ASCII_8BIT), 0)
            t = @sock.recvfrom(1460)[0]
            key = t[5...-1].to_i
            @key = Array(key).pack('N')
        end
    rescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH
        return "Host unreachable, check your configuration and try again"
        return "An Exception occured, please check last message"
    rescue StandardError => e
        return "An other error occured. Check your ruby installation and tell the tech monkey this:"
        return e
    end
end