# Telnet terminal issue

**URL:** <https://www.ruby-forum.com/t/telnet-terminal-issue/77391>\
**Category:** Ruby\
**Created:** [November 27, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/telnet-terminal-issue/77391 "2006-11-27T16:40:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [November 27, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/telnet-terminal-issue/77391/1 "2006-11-27T16:40:24Z")

</div>

Okay I am playing around with ruby and its telnet functionality and I  
ran into an interesting problem. I am trying to pull up a report from a  
telnet based program via ruby and I can navigate all the menus and enter  
the date and times for the report I want but as soon as it would usually  
pull up the report to the screen I receive this:

WARNING: terminal cannot clear to end of line  
WARNING: terminal cannot clear screen  
WARNING: terminal cannot home cursor  
WARNING: terminal cannot move cursor to lower left of screen  
WARNING: terminal cannot scroll backwards

I was just wondering if anyone here familiar with telnet shells might  
understand what I am seeing. I am wondering if it might be how ruby  
negotiates options with the server but I tried looking through Ethereal  
and it all generally looks the same as if I were to connect using Putty.  
Any ideas?  
thanks

Here is the full code:  
``

require ‘net/telnet’

#connect & login  
optim = Net::Telnet::new(“Host” =\> “xxx.xxx.xxx.xxx”,  
“Port” =\> 23,  
“Timeout” =\> 60,  
“Prompt” =\> /[?25h/,  
“Output\_log” =\> “out\_log.txt”,  
“Dump\_log” =\> “dump\_log.rtf”)  
optim.login(“username”, “pass”)  
puts “Connection Established.”

logFile = File.open(“C:\opt\_test.log”, “w”)

#navigate to report screen (menu items 1,5,1)  
sleep(1)  
optim.cmd(‘1’) { |rcv| puts rcv } #reports  
optim.cmd(‘5’) { |rcv| puts rcv } #sales  
optim.cmd(‘1’) { |rcv| puts rcv } #location activity

puts “Please enter the date of interest in MM/DD/YYYY:”  
date = gets.strip  
puts “Please enter the meal period (breakfast, lunch, dinner):”  
period = gets.strip

case period  
when “breakfast”  
sTime = “”  
eTime = “11:00:a”  
when “lunch”  
sTime = “11:01:a”  
eTime = “4:00:p”  
when “dinner”  
sTime = “4:01:p”  
eTime = “”  
else  
puts “Uknown meal period: #{period}”  
exit  
end

#enter info  
optim.puts(date.to\_s)  
optim.puts(sTime.to\_s)  
optim.puts(date.to\_s)  
optim.puts(eTime.to\_s)  
optim.write("\033OB\r") #down arrow for Location-Select  
#enter locations for report  
optim.puts(“843”)  
optim.puts(“850”)  
optim.puts(“823”)  
optim.write("\033OP\r") #exit location entry  
optim.puts("")  
optim.puts("")  
optim.puts("")

#wait for “performing request”  
optim.waitfor(“Location:”) { |r| logFile.puts r  
puts r  
}

#scroll report and write to file  
optim.waitfor("(END)") { |r| logFile.puts r  
puts r  
optim.cmd(‘d’)  
}

optim.close  
outFile.close

---

<div class="post-metadata">

**Author:** ![combas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@combas](https://www.ruby-forum.com/u/combas)\
**Post date:** [November 27, 2006, 7:40pm UTC](https://www.ruby-forum.com/t/telnet-terminal-issue/77391/2 "2006-11-27T19:40:17Z")

</div>

Alex C. wrote:

> WARNING: terminal cannot scroll backwards  
> The full Telnet protocol consists of hundreds of properties that the  
> local  
> machine may or may not be able to support. If the local Telnet session  
> reports that it supports a property, such as the ability to clear the  
> screen, and then balks at a subsequent command to do so, the sort of  
> message you are getting is the result.

Perhaps the server requires the functionality that it is reporting on,  
and  
cannot function at all without it. If that is the case, the specific  
site  
you visited may not work out.

Many Telnet servers don’t care about the more advanced features, but  
some  
require them. The local Telnet client session may not be able to find  
out  
whether the require property exists (because it cannot query the console  
you are using), or it may not be forwarding it correctly, or some third  
possibility.
