module EventMachine::Protocols
Constants
- SimpleTelnet
Provides the facility to connect to telnet servers using
EventMachine
. The asynchronity is hidden so you can use this library just like Net::Telnet in a seemingly synchronous manner. See README for an example.@example Standalone
opts = { host: "localhost", username: "user", password: "secret", } EM::P::SimpleTelnet.new(opts) do |host| # At this point, we're already logged in. host.cmd("touch /my/file") # get some output puts host.cmd("ls -la") host.timeout(30) do # custom timeout for this block host.cmd "slow command" end end
@example Inside an existing
EventMachine
loopEventMachine.run do opts = { host: "localhost", username: "user", password: "secret", output_log: "output.log", # log output to file command_log: "command.log", # log commands to file } EM::P::SimpleTelnet.new(opts) do |host| # already logged in puts host.cmd("ls -la") end end