Forum: Ruby Net::Telnet and sysread()

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7170a609aeade7f18f629041f72974f9?d=identicon&s=25 Will Shattuck (Guest)
on 2006-01-05 07:26
(Received via mailing list)
I'm trying establish a telnet connection to nethack.alt.org.  I can
get a connection but Net::Telnet cannot seem to handle the output.  In
reading net/telnet.rb I found out about IO#sysread so i put this
little tnet.rb file together

require 'net/telnet'

print("\n")
tn = Net::Telnet.new(
	'Host'		=> 'nethack.alt.org',
	'Timeout'	=> 10,
	'Telnetmode'	=> true) { |str| print str }

input = tn.sysread(1024 * 1024)
print("\nDisplaying Output\n	")
print(input)


Now when I connect here is the output that is displayed:
E:\Ruby\mkNethackbot>ruby tnet.rb

Trying nethack.alt.org...
Connected to nethack.alt.org.

Displaying Output
         ©÷¡è ©÷  ©÷# ©÷'E:\Ruby\mkNethackbot>

As you can see from the "Displaying Output" section the data that
nethack.alt.org is sending doesn't seem readable by Net::Telnet.
nethack.alt.org appears to use a scripted login instead of a standard
login/password prompt.

Any ideas?

Thanks,
Will




--
Will Shattuck  ( willshattuck.at.gmail.com )
Home Page:  http://www.thewholeclan.com/will

When you get to your wit's end, you'll find God lives there.
This topic is locked and can not be replied to.