Govno Govnovic01
2008-Dec-27 04:32 UTC
[Eventmachine-talk] undefined method `associate_callback_target''
I''m implemented very simple "echo" server using evenmachine, but I''m getting: undefined method `associate_callback_target'': /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1373:in `new'': undefined method `associate_callback_target'' for #<#<Class:0xb7d94c54>:0xb7d8de2c> (NoMethodError) from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1367:in `instance_eval'' from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1367:in `new'' from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1200:in `event_callback'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:804:in `eventable_read'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:801:in `times'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:801:in `eventable_read'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in `crank_selectables'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in `each'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in `crank_selectables'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:315:in `run'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:309:in `loop'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:309:in `run'' from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:64:in `run_machine'' from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:237:in `run'' Am I doing something wrong? I test is very simple: 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 "127.0.0.1", 22122, EchoServer } telnet 127.0.0.1 22122 Thanks! Aidin
Chuck Remes
2008-Dec-27 08:45 UTC
[Eventmachine-talk] undefined method `associate_callback_target''
On Dec 27, 2008, at 6:32 AM, Govno Govnovic01 wrote:> I''m implemented very simple "echo" server using evenmachine, but I''m > getting: undefined method `associate_callback_target'': > > /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1373:in `new'': > undefined method `associate_callback_target'' for > #<#<Class:0xb7d94c54>:0xb7d8de2c> (NoMethodError) > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1367:in > `instance_eval'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb: > 1367:in `new'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1200:in > `event_callback'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 804:in > `eventable_read'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 801:in `times'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 801:in > `eventable_read'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 360:in > `crank_selectables'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 360:in `each'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 360:in > `crank_selectables'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 315:in `run'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 309:in `loop'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb: > 309:in `run'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:64:in > `run_machine'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:237:in > `run'' > > Am I doing something wrong? > I test is very simple: > > 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 "127.0.0.1", 22122, EchoServer > }You are probably running the pure ruby version of EM. The method #associate_callback_target is *not* defined in eventmachine/lib/ eventmachine.rb like it should be. If you look at the C++ source or the Java source, you will find this method is a no-op. Edit the eventmachine.rb source file and add: def associate_callback_target nil end Save the file and try again; it should work. I submitted a ticket (and patch) on this issue about 9 months ago but now I can''t find it. I''ll resubmit... cr
Chuck Remes
2008-Dec-27 08:47 UTC
[Eventmachine-talk] undefined method `associate_callback_target''
Oops, that method should take a single parameter. Try def associate_callback_target sig nil end cr On Dec 27, 2008, at 10:45 AM, Chuck Remes wrote:> You are probably running the pure ruby version of EM. The method > #associate_callback_target is *not* defined in eventmachine/lib/ > eventmachine.rb like it should be. If you look at the C++ source or > the Java source, you will find this method is a no-op. > > Edit the eventmachine.rb source file and add: > > def associate_callback_target > nil > end > > Save the file and try again; it should work. > > I submitted a ticket (and patch) on this issue about 9 months ago > but now I can''t find it. I''ll resubmit...
Aman Gupta
2008-Dec-27 11:55 UTC
[Eventmachine-talk] undefined method `associate_callback_target''
How did you install eventmachine? You''re probably better off installing it as a gem (it seems to be in site_ruby in your installation). Rubygems should compile a C extension during the install, which is much more stable and well tested than the pure ruby version. Aman On Sat, Dec 27, 2008 at 4:32 AM, Govno Govnovic01 <govno3001 at gmail.com> wrote:> I''m implemented very simple "echo" server using evenmachine, but I''m > getting: undefined method `associate_callback_target'': > > /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1373:in `new'': > undefined method `associate_callback_target'' for > #<#<Class:0xb7d94c54>:0xb7d8de2c> (NoMethodError) > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1367:in > `instance_eval'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1367:in `new'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:1200:in > `event_callback'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:804:in > `eventable_read'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:801:in `times'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:801:in > `eventable_read'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in > `crank_selectables'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in `each'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:360:in > `crank_selectables'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:315:in `run'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:309:in `loop'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:309:in `run'' > from /usr/local/lib/ruby/site_ruby/1.8/pr_eventmachine.rb:64:in > `run_machine'' > from /usr/local/lib/ruby/site_ruby/1.8/eventmachine.rb:237:in `run'' > > Am I doing something wrong? > I test is very simple: > > 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 "127.0.0.1", 22122, EchoServer > } > > telnet 127.0.0.1 22122 > > Thanks! > Aidin > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >