Class: StatsD::Instrument::UdpConnection
- Inherits:
-
Object
- Object
- StatsD::Instrument::UdpConnection
- Defined in:
- lib/statsd/instrument/udp_connection.rb
Constant Summary collapse
- DEFAULT_MAX_PACKET_SIZE =
1_472
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(host, port) ⇒ UdpConnection
constructor
A new instance of UdpConnection.
- #send_datagram(message) ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(host, port) ⇒ UdpConnection
Returns a new instance of UdpConnection.
10 11 12 13 |
# File 'lib/statsd/instrument/udp_connection.rb', line 10 def initialize(host, port) @host = host @port = port end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/statsd/instrument/udp_connection.rb', line 8 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/statsd/instrument/udp_connection.rb', line 8 def port @port end |
Instance Method Details
#close ⇒ Object
19 20 21 22 |
# File 'lib/statsd/instrument/udp_connection.rb', line 19 def close @socket&.close @socket = nil end |
#send_datagram(message) ⇒ Object
15 16 17 |
# File 'lib/statsd/instrument/udp_connection.rb', line 15 def send_datagram() socket.send(, 0) end |
#type ⇒ Object
24 25 26 |
# File 'lib/statsd/instrument/udp_connection.rb', line 24 def type :udp end |