ruby - Rails app which connects users to telnet server -
right there few mud clients date; graphically outdated , not user friendly.
i want create rails app users can login , connect different muds (aka telnet servers). know ruby has 'net/telnet' library not sure how works or how implement rails.
i unsure of how allow user interact , 4th telnet server. suggestions on how go doing this?
i able find one source on throughout internet, documentation poor , not suitable purposes. help appreciated, thanks!
adding:
require 'net/telnet'
is plenty utilize it. can follow documentation:
http://ruby-doc.org/stdlib-1.9.3/libdoc/net/telnet/rdoc/net/telnet.html#class-net::telnet-label-examples
to implement rails can create class in libs allows users stablish connection desired host:
class telnetclient require 'net/telnet' def self.new_connection(data_hash) net::telnet::new("host" => data_hash["host"], "timeout" => data_hash["timeout"], "prompt" => /[$%#>] \z/n) end end class connectionscontroller < applicationcontroller def new_connection $localhost = telnetclient.new_connection(connection_params) #whatever need end def interactive_shell $localhost.cmd(params[:string]) #other actions end private def connection_params params.require(:connection).permit(:host, :timeout) end end
and create nice interactive shell javascript in view allow users interact controller via ajax.
ruby-on-rails ruby telnet
No comments:
Post a Comment