Skip to content

Instantly share code, notes, and snippets.

@mkroman
Created November 16, 2010 08:13
Show Gist options
  • Save mkroman/701578 to your computer and use it in GitHub Desktop.
Save mkroman/701578 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
require 'socket'
DefaultHost = 'dpmaster.deathmask.net'
DefaultPort = 27950
ChunkSize = 2**16
UDPSocket.new.tap do |socket|
socket.connect DefaultHost, DefaultPort
socket.send "\xFF\xFF\xFF\xFFgetservers Warsow 11 full empty \0", 0
if data = socket.recvfrom(ChunkSize)[0]
puts data.bytes.to_a.map{ |c| c.to_s(16).rjust 2, '0' }.join(' ').upcase
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment