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.
on 2013-01-10 10:42
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.