#!/usr/local/bin/ruby require 'webrick' include WEBrick require 'net/telnet' server = HTTPServer.new( :Port => 2000 ) class ControlServlet < HTTPServlet::AbstractServlet @@connection = Net::Telnet::new("Host" => "192.168.1.6", "Port" =>6546, "Timeout" => 3, # "Output_log" => "output_log", "Prompt" => /[$%#>] \z/n) puts "creating connection" def do_GET(req, res) res['Content-Type'] = "text/html" res.body = %Q[
] res.body = res.body + %Q[| PAUSE | UP | - |
| LEFT | ENTER | RIGHT |
| BACK | DOWN | + |
" + @@connection.cmd(command_string) + "\n" + "" end end server.mount("/", ControlServlet) trap("INT"){ server.shutdown @@connection.close } server.start