Skip to content

Instantly share code, notes, and snippets.

@careo
Created April 17, 2009 06:59
Show Gist options
  • Select an option

  • Save careo/96894 to your computer and use it in GitHub Desktop.

Select an option

Save careo/96894 to your computer and use it in GitHub Desktop.
require 'pp'
require 'rubygems'
require 'eventmachine'
module XplaneServer
def post_init
end
def data_struct
"l f8"
end
def pack_str
"a4 C #{data_struct} a*" # message internal-index data-index 8-floats other
end
def receive_data data
# unpacks the first element. further unpack(data_struct) calls will grab each additional
p data.unpack(pack_str) #.last.unpack("l f8")
end
end
EM.run {
EM.open_datagram_socket('127.0.0.1', 48000,XplaneServer)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment