Why time out?
Net::Telnetthe documentation says:
Prompt , Telnet cmd(); , cmd(), puts() waitfor(); sysread() waitfor() .
Net::Telnet#cmd , , :
, .
Prompt Match, #cmd - , Net::Telnet (/[$%#>] \z/n), ,
, .
- , , , , , , Net::Telnet. , command:, :
connection = Net::Telnet.new(
"Prompt" => /command: \z/,
)
, , , , Match, #cmd. , JSON, ], :
connection.cmd("String" => "{weather}", "Match" => "]") { |c| print c }
Net::Telnet TCPSocket
, Net::Telnet, TCPSocket, #cmd:
connection.puts("{weather}")
connection.sock.readline
Net::Telnet TCPSocket.