On Fri, Jun 11, 2010 at 2:15 PM, Leonardo Mateo <leonardoma...@gmail.com> wrote: > On Fri, Jun 11, 2010 at 12:00 PM, doug <ddjol...@gmail.com> wrote: >>> You have to read from your socket. >> >> Ahh! I get it. (I said that I was green at this.) I now have it >> working except that it is REALLY slow. >> >>> Can you post some more of the code? >> >> Here is my code that is now working: >> >> require 'socket' >> socket=TCPSocket::open("ip","port") >> out=File.open('/tmp/debug1','w') >> while line=socket.gets >> out.puts(line.chop) >> end >> socket.close >> out.close >> >> Do you have any idea why this would be very slow? Thanks. >> > It's hard to say with no information, but it can be a slow connection. > I know there's a way to get the data asynchronously. I've even used it > but a while ago, I should take a look at that code to point it to you, > but this will avoid the while loop. > You can check the code on one of my github repositories. It is an unfinished project but that part works. http://github.com/kandalf/fluxy/blob/master/lib/fluxy_receiver.rb Take a look at the run method there. That's for a server socket but might help you otu with this.
Hope it helps. -- Leonardo Mateo. There's no place like ~ -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.