I can’t seem to find my error. I think it’s fairly basic. Do I have to
initialize SockServ somewhere or is this error message really indicating
something else?
uninitialized constant SockServ
C:/rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in
const_missing' #{RAILS_ROOT}/app/controllers/mindreadr_controller.rb:15:in
get_reordered_images’
This error occured while loading the following files:
sock_serv.rb
This is in my ApplicationController (partila)
def get_reordered_images
# eventually send in image IDs, for now, send in nothing, just get
images
@response = SockServ.open_send_receive
# now unwrap XML response, and create list of image IDs to display
render(:layout => false)
end
This is in my apps/models directory (sockserv.rb)
class SockServ
def initialize
end
def self.open_send_receive
# open a socket here and send the data in the xml var
# read from the socket the response and use it as the return
require "socket"
STDOUT.flush
# s is an instance of a socket
@socket = TCPSocket.open("nnn.nnn.nnn.n", 9000)
sending xml to just opened socket (send is std call)
@xml = "<?xml version="1.0" ?>
<transaction>
<version> 2.0 </version>
<ctrl>
<mode> pbir </mode>
<option>
<resultImageSize> 16 </resultImageSize>
</option>
</ctrl>
</transaction>"
@socket.send(@xml)
@socket.recv
end
end