B
born in USSR
code:
if the command is "ping 192.168.1.2" application would stop.
Timeout::timeout() doesn't stop performance tserv.cmd(command) in 5
seconds. How is it possible to stop performance or receive Ñertain
quantity of bytes from telnet-server?
require "net/telnet"
require 'timeout'
...
tserv = Net::Telnet::new("Host" => $TELNET_ADDRESS,
"Timeout" => 10,
"Prompt" => /[$%#>] \z/n)
ans=tserv.login(user_login,user_paswd)
command="ping -c 4 192.168.1.2"
ans=''
err=Timeout::timeout(5) do
tserv.cmd(command){|c| ans+=c.to_s}
end
puts ans
...
if the command is "ping 192.168.1.2" application would stop.
Timeout::timeout() doesn't stop performance tserv.cmd(command) in 5
seconds. How is it possible to stop performance or receive Ñertain
quantity of bytes from telnet-server?