I''m working on a protocol state machine I intend to share with this list for feedback, but before we get that far I could use a little help: Firefly:~/Desktop$ cat em_echo.rb #!/usr/local/bin/ruby -w require ''rubygems'' require ''eventmachine'' module EchoServer def receive_data data send_data ">>>you sent: #{data}" close_connection if data =~ /quit/i end end EventMachine::run { EventMachine::start_server "192.168.0.100", 8081, EchoServer } Firefly:~/Desktop$ ruby em_echo.rb /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ eventmachine.rb:190: warning: `&'' interpreted as argument prefix /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ eventmachine.rb:419:in `start_tcp_server'': no acceptor (RuntimeError) from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ lib/eventmachine.rb:419:in `start_server'' from em_echo.rb:14 from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ lib/eventmachine.rb:621:in `event_callback'' from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ lib/eventmachine.rb:178:in `run'' from em_echo.rb:13 Uh, it broke... :( James Edward Gray II
Try using an IP address that''s valid on your machine. We really should change that 192.168.0.100 that''s given in the sample code. On 5/24/06, James Edward Gray II <james at grayproductions.net> wrote:> > I''m working on a protocol state machine I intend to share with this > list for feedback, but before we get that far I could use a little help: > > Firefly:~/Desktop$ cat em_echo.rb > #!/usr/local/bin/ruby -w > > require ''rubygems'' > require ''eventmachine'' > > module EchoServer > def receive_data data > send_data ">>>you sent: #{data}" > close_connection if data =~ /quit/i > end > end > > EventMachine::run { > EventMachine::start_server "192.168.0.100", 8081, EchoServer > } > Firefly:~/Desktop$ ruby em_echo.rb > /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ > eventmachine.rb:190: warning: `&'' interpreted as argument prefix > /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ > eventmachine.rb:419:in `start_tcp_server'': no acceptor (RuntimeError) > from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ > lib/eventmachine.rb:419:in `start_server'' > from em_echo.rb:14 > from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ > lib/eventmachine.rb:621:in `event_callback'' > from /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/ > lib/eventmachine.rb:178:in `run'' > from em_echo.rb:13 > > Uh, it broke... :( > > James Edward Gray II > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20060524/de813a60/attachment.htm
On May 24, 2006, at 10:29 AM, Francis Cianfrocca wrote:> Try using an IP address that''s valid on your machine. We really > should change that 192.168.0.100 that''s given in the sample code.Duh. Thanks. I feel suitably dumb now. ;)> On 5/24/06, James Edward Gray II <james at grayproductions.net> wrote: > >> Firefly:~/Desktop$ ruby em_echo.rb >> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ >> eventmachine.rb :190: warning: `&'' interpreted as argument prefixJust FYI, this is a warning thrown by starting EventMachine. Attached is the patch to fix it. James Edward Gray II -------------- next part -------------- A non-text attachment was scrubbed... Name: silence_warning.patch Type: application/octet-stream Size: 467 bytes Desc: not available Url : http://rubyforge.org/pipermail/eventmachine-talk/attachments/20060524/3bc6c31e/attachment.obj
Thx for the patch James- I just applied it to the SVN source. This also points out one of EvMa''s shortcomings- error reporting coming from the C++ code is not too useful. The smoking gun is here: eventmachine.rb:419:in `start_tcp_server'': no acceptor (RuntimeError) but how were you to know? So we gotta improve the error reporting as we go along. Also, have a look at the cool stuff Jeff Rose is doing in regard to pure Ruby: experiments/machine in the SVN tree. On 5/24/06, James Edward Gray II <james at grayproductions.net> wrote:> > On May 24, 2006, at 10:29 AM, Francis Cianfrocca wrote: > > > Try using an IP address that''s valid on your machine. We really > > should change that 192.168.0.100 that''s given in the sample code. > > Duh. Thanks. I feel suitably dumb now. ;) > > > On 5/24/06, James Edward Gray II <james at grayproductions.net> wrote: > > > >> Firefly:~/Desktop$ ruby em_echo.rb > >> /usr/local/lib/ruby/gems/1.8/gems/eventmachine-0.5.3/lib/ > >> eventmachine.rb :190: warning: `&'' interpreted as argument prefix > > Just FYI, this is a warning thrown by starting EventMachine. > Attached is the patch to fix it. > > James Edward Gray II > > > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20060524/208d1a3f/attachment.htm