I haven''t done any DRb stuff in awhile, but I used to connect to a DRb
server from
a rails controller. I''ve never tried it in rails 3 and am wondering if
Rails 3 is stricter about something like this or why it hasn''t worked
thus far.
My server/client code and error are shown below:
SERVER:
require ''drb''
class ParserSvc
def initialize
end
def check
return ''ok''
end
end
svc = ParserSvc.new
DRb.start_service ''druby://:9000'', svc
puts "Server running at #{DRb.uri}"
trap("INT") { DRb.stop_service }
DRb.thread.join
----------------------------------
Client code in application controller:
require ''drb''
class ApplicationController < ActionController::Base
protect_from_forgery
def parser_svc
# svc = nil
svc = DRbObject.new nil, ''druby://:9000''
svc
end
end
main controller:
def pcheck
svc = parser_svc
res = svc.check
render :text => res
end
when called and server is running get this error:
DRb::DRbConnError (druby://:9000 - #<Errno::EADDRNOTAVAIL: The
requested address
is not valid in its context. - connect(2)>):
app/controllers/main_controller.rb:15:in `pcheck''
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.