+
Skip to content

Two ruby scripts that can ask anyone that's listening for their hostname and number of cores.

Notifications You must be signed in to change notification settings

aduane/rollcall

Repository files navigation

rollcall

Two ruby scripts that can ask anyone that's listening for their hostname and number of cores.

ruby server_info_control.rb start: listen on port 33333 for someone to request their stats, then respond on port 33334. "I am an available server to test on".

ruby server_info_control.rb stop: stop listening/responding. "..."

require 'rollcall'
test_server_info = Rollcall.call_roll

Broadcast to port 33333 to solicit information, then listen for responses for 2 seconds on port 33334.

p test_server_info
=> { "new-test-machine-<uuid>.local" => {cores: 8, role: :test_0}, "new-test-machine-<other-uuid>.local" => {cores: 16, role: :test_1}}

Based on super handy code examples on betterlogic.com

Specifically this one: http://betterlogic.com/roger/2009/06/ruby-udp-broadcast-simple-example/

And this one: http://betterlogic.com/roger/2010/03/ruby-udp-socket-example/

About

Two ruby scripts that can ask anyone that's listening for their hostname and number of cores.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载