I received the following reply from Francis C. to a posting in the Ruby forum. Francis Cianfrocca wrote: > On 9/2/07, Mark Zvilius wrote: >> >> I want to use Ruby for a UDP server application under Windows XP. I >> intend to use two threads: one for a simple UI, and a separate thread >> for the UDP server (with blocking calls). >> >> As a proof of concept I wrote the following test code, whose intent is >> to wait for an incoming message, with the user able to press CTRL-C to >> terminate the "server." > > > > Look at Ruby/EventMachine, which can solve your problem without threads. > Sync to the current head revision to get a recent addition which allows > you > to respond to keyboard input. I''ve been playing with EventMachine, and have a couple of questions. 1. Francis mentioned "a recent addition which allows you to respond to keyboard input." I haven''t found any reference to that capability. I am using eventmachine 0.8.1 .. is that the current version? If so, please point me to the feature that Francis suggested. (I''m developing in the Windows environment.) 2. One thing I need to do is implement a discovery protocol, involving a UDP broadcast. I don''t see a way to set SO_BROADCAST on the underlying socket. Is there any way to do that? Thanks, Mark Zvilius
On 9/10/07, Mark Zvilius <zvilius at ieee.org> wrote:> > > I''ve been playing with EventMachine, and have a couple of questions. > > 1. Francis mentioned "a recent addition which allows you to respond to > keyboard input." I haven''t found any reference to that capability. I am > using eventmachine 0.8.1 .. is that the current version? If so, please > point me to the feature that Francis suggested. (I''m developing in the > Windows environment.) > > 2. One thing I need to do is implement a discovery protocol, involving a > UDP broadcast. I don''t see a way to set SO_BROADCAST on the underlying > socket. Is there any way to do that? > > Thanks, > Mark Zviliussync to the current head revision. There is a file named KEYBOARD that will answer your questions about the keyboard handling. For UDP broadcasts, just sent the packet to a target address of 255.255.255.255 to get a broadcast on your local lan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20070911/02daba11/attachment.html
"sync to the current head revision."
I''m not familiar with this process, could you help me get off the
ground?
What I tried is copied below. It looks like setup.rb is trying to find
<windows.h>, so I''ll work on getting the right include paths so
that it is
found, but if I''m going about this the wrong way please let me know.
Thanks!
Mark Z.
Made a copy of my /ruby tree --> /rubz, then.
C:\>svn co svn://rubyforget.org/var/svn/eventmachine/version_0 x
C:\>cd x
C:\x>setup all --prefix=c:/rubz
---> lib
---> lib/em
<--- lib/em
---> lib/evma
<--- lib/evma
---> lib/protocols
<--- lib/protocols
<--- lib
---> ext
c:/ruby/bin/ruby.exe C:/x/ext/extconf.rb
checking for windows.h... no
*** C:/x/ext/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=C:/x/ext
--curdir
--ruby=c:/ruby/bin/ruby
.
_____
From: eventmachine-talk-bounces at rubyforge.org
[mailto:eventmachine-talk-bounces at rubyforge.org] On Behalf Of Francis
Cianfrocca
Sent: Tuesday, September 11, 2007 10:47 AM
To: eventmachine-talk at rubyforge.org
Subject: Re: [Eventmachine-talk] keyboard input & broadcast
sync to the current head revision. There is a file named KEYBOARD that will
answer your questions about the keyboard handling.
For UDP broadcasts, just sent the packet to a target address of
255.255.255.255 to get a broadcast on your local lan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/eventmachine-talk/attachments/20070911/dd169aab/attachment-0001.html