in my model, I have:
attr_accessor :socket
in my controller I have
def toServer(s)
begin
if(@socket == nil)
@socket = TCPSocket::new(@channel.serverip, @channel.port)
end
@socket.send(s,0)
rescue
return
end
end
I have a dropdown list in the view that lets the user select a
different channel, thus, the socket is created in the view based on
the ip and port of the selected channel.
Usually, however, the channel info will remain the same. So I am
wondering how I can make the socket persist from one POST/GET
operation to the other, unless the channel has changed.
And my second question is, if I someone does tell me how I can make it
persist, do I run the risk of some sort of memory leaks here with
this? I wonder because I have a solitary TCPSocket object which would
then be reassigned -- does the un-assigned old reference that socket
contained go automatically out of scope and get garbage collected?
Thanks, Janna B
repeatedly in my controller, naturally,
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---