Help!
I need someone to get me in the right ballpark. I’ve been going around
in circles for the last 24 hours.
I want to open a TCPsocket on another server and eventually send and
receive XML which is what the other servers speaks.
I have both “Agile Web…with Ruby” and “Programming Ruby” but can find
no examples. I’ve poured over the forum list, too.
I’ve played with examples such as:
<label for="search">Search term:</label>
<%= text_field_tag :search %>
<%= observe_field( :search,
:frequency => 0.5,
:update => :results,
:url => { :action => :search }) %>
<div id="results"></div>
and I have changed this and that parameter and I know how and where to
put the elements to WRITE some HTML, but I’m still clueless about
getting some real work done, i.e., opening a socket, sending XML,
receiving XML, sending, receiving, etc. Then I can write.
I suspect I have to use these statements, but I’m lost regarding whether
they go in views, models, layouts are they actions, or modules or
helpers
require “socket”
STDOUT.flush
s = TCPSocket.open(“nnn.nnn.nnn.n”, 9000)
Just a little guidance or pointing me to an example and I bet I can work
it out.
Basically, I need to:
-
When a button is pushed [link_to_remote?? ]
-
Open a socket to another server (eventually I guess I’ll do this
once ahead of time) Hmmm…I will do it ahead of time now (but where
does the code go (this is really my major stumbling block)? Does it go
in my index (but that’s all HTML, is it a helper that is called at the
beginning of index?) -
Send XML command that other server understands
-
Listen for response
-
Unwrap the response and print data on page
-
Once I have this figured out, I will substitute file contents for
the returned data, but just getting the data will be a real victory.
Thanks…again, I don’t expect anyone to write my code, just help me
with a map of how one creates actions that are not HTML builders.
Dave