Class: Linr::Connection::UDP
- Inherits:
-
Object
- Object
- Linr::Connection::UDP
- Defined in:
- lib/linr/connection/udp.rb
Overview
Connects to a InfluxDB UDP port
Constant Summary collapse
- SEND_FLAGS =
Use non-custom flags
0
Instance Method Summary collapse
-
#initialize(host, port) ⇒ UDP
constructor
Establishes a connection.
-
#send(data) ⇒ Object
Send data over the UDP connection.
Constructor Details
#initialize(host, port) ⇒ UDP
Establishes a connection
16 17 18 19 |
# File 'lib/linr/connection/udp.rb', line 16 def initialize(host, port) @socket = UDPSocket.new @socket.connect(host, port) end |
Instance Method Details
#send(data) ⇒ Object
Send data over the UDP connection. Should be encoded using the Line Protocol.
25 26 27 |
# File 'lib/linr/connection/udp.rb', line 25 def send(data) @socket.send(data, SEND_FLAGS) end |