Class: CollectdServer::Runner
- Inherits:
-
Object
- Object
- CollectdServer::Runner
- Defined in:
- lib/collectd_server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(port = 1981, services = 'http://auth.v6.localhost/services') ⇒ Runner
constructor
A new instance of Runner.
- #run! ⇒ Object
Constructor Details
#initialize(port = 1981, services = 'http://auth.v6.localhost/services') ⇒ Runner
Returns a new instance of Runner.
18 19 20 21 |
# File 'lib/collectd_server.rb', line 18 def initialize(port = 1981, services = 'http://auth.v6.localhost/services') @port = port @services = services end |
Instance Attribute Details
#port ⇒ Object
Returns the value of attribute port.
16 17 18 |
# File 'lib/collectd_server.rb', line 16 def port @port end |
Instance Method Details
#run! ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/collectd_server.rb', line 23 def run! @socket = UDPSocket.new @socket.bind(nil, port) @connection = Connection.new(@services) loop do data = @socket.recvfrom(65535) @connection.receive_data(data.first) end end |