Sha256: e09d05fff302cd7060a9116109b337678776caea539cf93588cd6b262e73e524
Contents?: true
Size: 715 Bytes
Versions: 9
Compression:
Stored size: 715 Bytes
Contents
require 'uri' require 'socket' require 'timeout' require 'panoptimon-collector-socket/socket' module Panoptimon module Collector class Socket class TCP < Panoptimon::Collector::Socket attr_accessor :host, :port def initialize(options={}) opt = defaults.merge(options) super(opt) @port = opt[:port] @host = @path.match('\w+:\/\/') ? URI(@path).host : @path end def defaults super.merge({ path: 'http://localhost', port: 80, timeout: 10, }) end def get_banner TCPSocket.new(host, port).recv(100) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems