Hi,
in order to stream a file I am making use of TCPSocket. Unfortunately I
dont receive contents when in use the tcpsocket in a rails controller
action while it is working on console.
url = "http://www.google.de"
version = request.env[''HTTP_VERSION'']
verb = request.env[''REQUEST_METHOD'']
# url = request.env[''REQUEST_URI'']
puts url
uri = URI::parse url
to_server = TCPSocket.new(uri.host, (uri.port.nil? ? 80 : uri.port))
puts "#{verb} #{url} #{version}\r\n"
to_server.write("#{verb} #{url} #{version}\r\n")
puts to_server
puts to_server.closed?
puts "before while"
#THIS LOOPS TAKES TOO LONG BECAUSE to_server.gets RETURNS EMTPY
# while s = to_server.gets
# puts s
# end
puts "close"
to_server.close
Help is appreciated.
Best, Phil
I apologize for doing this double post on stackoverflow and here. but I
didn''t get a response so far.
--
Posted via http://www.ruby-forum.com/.
--
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 https://groups.google.com/groups/opt_out.