Class: Argus::UdpSender
- Inherits:
-
Object
- Object
- Argus::UdpSender
- Defined in:
- lib/argus/udp_sender.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ UdpSender
constructor
A new instance of UdpSender.
- #send_packet(data) ⇒ Object
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 |