Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3055

Telnet "More?"

From "Eric T." <erictetz@gmail.com>
Newsgroups comp.lang.ruby
Subject Telnet "More?"
Date Sun, 17 Apr 2011 02:10:54 -0500
Organization Service de news de lacave.net
Lines 61
Message-ID <0bc1be8ec871e5fbad7753c695247ddc@ruby-forum.com> (permalink)
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1303024274 68379 65.111.164.187 (17 Apr 2011 07:11:14 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Sun, 17 Apr 2011 07:11:14 +0000 (UTC)
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 381742
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <0bc1be8ec871e5fbad7753c695247ddc@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!feed.ac-versailles.fr!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:3055

Show key headers only | View raw


I'm trying to use the telnet library. I don't know Ruby AT ALL
(evaluating it side by side with Python to see which is going to be best
for my admin chores; this is my very first script), and this has got me
stumped:

   require 'net/telnet'
   t = Net::Telnet::new(
      'Host'       => 'somehost.com',
      'Prompt'     => /:.*>/,
   )
   out = lambda do |c| print c end
   t.login('someusername', 'somepassword', &out)
   t.cmd('dir', &out)
   t.cmd('dir', &out)

The second dir command hangs with the server responding "More?" Here's
the tail end of the output log, after the first dir command:

   ...
   04/13/2011  04:21 PM    <DIR>          Searches
   04/13/2011  04:21 PM    <DIR>          Videos
   04/16/2011  12:54 AM             6,558 _viminfo
                  1 File(s)          6,558 bytes
                 13 Dir(s)  279,022,981,120 bytes free

   C:\Users\foo>dir
   More?

And it just hangs there.

Full logs here (names changed to protect the innocent):
   http://tetzfiles.com/temp/output_log
   http://tetzfiles.com/temp/dump_log

This is a bitch to Google ("?" is ignored), but I found someone else
asking the same question on Stackoverflow, but he got no response
(http://stackoverflow.com/questions/3450942/ruby-telnet-lib-weird-response).
You guys could help both of us out. :)

------------------------------------------------------------------

In a slightly unrelated question, I don't understand why I have to do
this:

   out = lambda do |c| print c end
   t.login('someusername', 'somepassword', &out)
   t.cmd('dir', &out)
   t.cmd('dir', &out)

Rather than simply this:

   t.login('someusername', 'somepassword', &print)
   t.cmd('dir', &print)
   t.cmd('dir', &print)

Seems kinda pointless to make a function which does nothing but pass
it's arguments unaltered to another function.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Telnet "More?" "Eric T." <erictetz@gmail.com> - 2011-04-17 02:10 -0500
  Re: Telnet "More?" Christopher Dicely <cmdicely@gmail.com> - 2011-04-17 09:56 -0500
    Re: Telnet "More?" "Eric T." <erictetz@gmail.com> - 2011-04-17 20:00 -0500
  Re: Telnet "More?" 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-17 17:47 -0500
    Re: Telnet "More?" "Eric T." <erictetz@gmail.com> - 2011-04-17 19:48 -0500
      Re: Telnet "More?" Christopher Dicely <cmdicely@gmail.com> - 2011-04-18 00:37 -0500
      Re: Telnet "More?" 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-19 12:21 -0500
  Re: Telnet "More?" "mouser" <invalid@invalid.com> - 2011-04-18 04:18 +0000
    Re: Telnet "More?" "mouser" <invalid@invalid.com> - 2011-04-18 04:22 +0000
  Re: Telnet "More?" Brian Candler <b.candler@pobox.com> - 2011-04-19 04:18 -0500
    Re: Telnet "More?" "mouser" <invalid@invalid.com> - 2011-04-19 16:36 +0000
      Re: Telnet "More?" Markus Fischer <markus@fischer.name> - 2011-04-19 12:12 -0500

csiph-web