Sha256: 4175ee908aa04625cbb11633478f16f5a387269e7f2ce0427908c99edd13a783

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 Bytes

Contents

require 'socket'
require 'thread'

module Collectd
  class Server < Values

    def initialize(interval, host, port)
      super(interval)
      @sock = UDPSocket.new(Socket::AF_INET6)
      @sock.connect(host, port)

      Thread.new do
        loop do
          sleep interval

          Thread.critical = true
          pkt = make_pkt
          Thread.critical = false
          @sock.send(pkt, 0)
        end
      end.abort_on_exception = true
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
astro-collectd-0.0.4 lib/collectd/server.rb