From: Leslie Viljoen Date: 2008-06-11T08:07:20+09:00 Subject: Re: Non blocking UDP On Wed, Jun 11, 2008 at 12:52 AM, Joel VanderWerf wrote: > Bill Kelly wrote: >> >> I'm currently rewriting one of my UDP apps using eventmachine >> http://rubyeventmachine.com/ ... which presumably will solve >> the blocking issue. > > Interested to hear how that goes.... My issue is that I was using netcat without -u for UDP - I somehow do these things 1am ;-) But anyway, here's the eventmachine version which I am probably going to use because it is so very nice. Thanks for your example too! require 'eventmachine' module UmmpServer def post_init puts "client connected!" end def receive_data(data) p data end end EventMachine::run do EventMachine::open_datagram_socket('10.0.0.103', 7779, UmmpServer) EventMachine::add_periodic_timer(1) { puts "." } end Brilliant hey? Les