Getting a client's IP address with EventMachine
EventMachine::run { EventMachine::open_datagram_socket $conf[:address], $conf[:udp_port], CustomServer } module CustomServer def receive_data d pp get_peername[2,6].unpack "nC4" end end
DZone Snippets > peter > ip
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Peter Cooperx http://www.petercooper.co.uk/
EventMachine::run { EventMachine::open_datagram_socket $conf[:address], $conf[:udp_port], CustomServer } module CustomServer def receive_data d pp get_peername[2,6].unpack "nC4" end end
lookupd -flushcache