Class: Argus::UdpSender

Inherits:
Object
  • Object
show all
Defined in:
lib/argus/udp_sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ UdpSender

Returns a new instance of UdpSender


3
4
5
6
7
# File 'lib/argus/udp_sender.rb', line 3

def initialize(opts={})
  @udp_socket = opts[:socket] || UDPSocket.new
  @host = opts.fetch(:remote_host)
  @port = opts.fetch(:port, 5556)
end

Instance Method Details

#send_packet(data) ⇒ Object


9
10
11
# File 'lib/argus/udp_sender.rb', line 9

def send_packet(data)
  @udp_socket.send(data, 0, @host, @port)
end