Class: StatsD::Instrument::UdpConnection
- Inherits:
-
Object
- Object
- StatsD::Instrument::UdpConnection
- Includes:
- ConnectionBehavior
- 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
-
#initialize(host, port, max_packet_size: DEFAULT_MAX_PACKET_SIZE) ⇒ UdpConnection
constructor
A new instance of UdpConnection.
- #send_datagram(message) ⇒ Object
- #type ⇒ Object
Methods included from ConnectionBehavior
Constructor Details
#initialize(host, port, max_packet_size: DEFAULT_MAX_PACKET_SIZE) ⇒ UdpConnection
Returns a new instance of UdpConnection.
12 13 14 15 16 |
# File 'lib/statsd/instrument/udp_connection.rb', line 12 def initialize(host, port, max_packet_size: DEFAULT_MAX_PACKET_SIZE) @host = host @port = port @max_packet_size = max_packet_size end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
10 11 12 |
# File 'lib/statsd/instrument/udp_connection.rb', line 10 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/statsd/instrument/udp_connection.rb', line 10 def port @port end |
Instance Method Details
#send_datagram(message) ⇒ Object
18 19 20 |
# File 'lib/statsd/instrument/udp_connection.rb', line 18 def send_datagram() socket.send(, 0) end |
#type ⇒ Object
22 23 24 |
# File 'lib/statsd/instrument/udp_connection.rb', line 22 def type :udp end |