Your IP : 3.143.24.110


Current Path : /opt/alt/ruby18/share/ri/1.8/system/Net/Telnet/
Upload File :
Current File : //opt/alt/ruby18/share/ri/1.8/system/Net/Telnet/cdesc-Telnet.yaml

--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: The socket the Telnet object is using. Note that this object becomes a delegate of the Telnet object, so normally you invoke its methods directly on the Telnet object.
  name: sock
  rw: R
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: new
comment: 
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Net::Telnet
- !ruby/struct:SM::Flow::P 
  body: Provides telnet client functionality.
- !ruby/struct:SM::Flow::P 
  body: This class also has, through delegation, all the methods of a socket object (by default, a <tt>TCPSocket</tt>, but can be set by the <tt>Proxy</tt> option to <tt>new()</tt>). This provides methods such as <tt>close()</tt> to end the session and <tt>sysread()</tt> to read data directly from the host, instead of via the <tt>waitfor()</tt> mechanism. Note that if you do use <tt>sysread()</tt> directly when in telnet mode, you should probably pass the output through <tt>preprocess()</tt> to extract telnet command sequences.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Overview
- !ruby/struct:SM::Flow::P 
  body: "The telnet protocol allows a client to login remotely to a user account on a server and execute commands via a shell. The equivalent is done by creating a Net::Telnet class with the <tt>Host</tt> option set to your host, calling #login() with your user and password, issuing one or more #cmd() calls, and then calling #close() to end the session. The #waitfor(), #print(), #puts(), and #write() methods, which #cmd() is implemented on top of, are only needed if you are doing something more complicated."
- !ruby/struct:SM::Flow::P 
  body: "A Net::Telnet object can also be used to connect to non-telnet services, such as SMTP or HTTP. In this case, you normally want to provide the <tt>Port</tt> option to specify the port to connect to, and set the <tt>Telnetmode</tt> option to false to prevent the client from attempting to interpret telnet command sequences. Generally, #login() will not work with other protocols, and you have to handle authentication yourself."
- !ruby/struct:SM::Flow::P 
  body: "For some protocols, it will be possible to specify the <tt>Prompt</tt> option once when you create the Telnet object and use #cmd() calls; for others, you will have to specify the response sequence to look for as the Match option to every #cmd() call, or call #puts() and #waitfor() directly; for yet others, you will have to use #sysread() instead of #waitfor() and parse server responses yourself."
- !ruby/struct:SM::Flow::P 
  body: It is worth noting that when you create a new Net::Telnet object, you can supply a proxy IO channel via the Proxy option. This can be used to attach the Telnet object to other Telnet objects, to already open sockets, or to any read-write IO object. This can be useful, for instance, for setting up a test fixture for unit testing.
- !ruby/struct:SM::Flow::H 
  level: 2
  text: Examples
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Log in and send a command, echoing all output to stdout
- !ruby/struct:SM::Flow::VERB 
  body: "  localhost = Net::Telnet::new(&quot;Host&quot; =&gt; &quot;localhost&quot;,\n                               &quot;Timeout&quot; =&gt; 10,\n                               &quot;Prompt&quot; =&gt; /[$%#&gt;] \\z/n)\n  localhost.login(&quot;username&quot;, &quot;password&quot;) { |c| print c }\n  localhost.cmd(&quot;command&quot;) { |c| print c }\n  localhost.close\n"
- !ruby/struct:SM::Flow::H 
  level: 3
  text: Check a POP server to see if you have mail
- !ruby/struct:SM::Flow::VERB 
  body: "  pop = Net::Telnet::new(&quot;Host&quot; =&gt; &quot;your_destination_host_here&quot;,\n                         &quot;Port&quot; =&gt; 110,\n                         &quot;Telnetmode&quot; =&gt; false,\n                         &quot;Prompt&quot; =&gt; /^+OK/n)\n  pop.cmd(&quot;user &quot; + &quot;your_username_here&quot;) { |c| print c }\n  pop.cmd(&quot;pass &quot; + &quot;your_password_here&quot;) { |c| print c }\n  pop.cmd(&quot;list&quot;) { |c| print c }\n"
- !ruby/struct:SM::Flow::H 
  level: 2
  text: References
- !ruby/struct:SM::Flow::P 
  body: There are a large number of RFCs relevant to the Telnet protocol. RFCs 854-861 define the base protocol. For a complete listing of relevant RFCs, see http://www.omnifarious.org/~hopper/technical/telnet-rfc.html
constants: []

full_name: Net::Telnet
includes: []

instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: binmode
- !ruby/object:RI::MethodSummary 
  name: binmode=
- !ruby/object:RI::MethodSummary 
  name: cmd
- !ruby/object:RI::MethodSummary 
  name: login
- !ruby/object:RI::MethodSummary 
  name: preprocess
- !ruby/object:RI::MethodSummary 
  name: print
- !ruby/object:RI::MethodSummary 
  name: puts
- !ruby/object:RI::MethodSummary 
  name: telnetmode
- !ruby/object:RI::MethodSummary 
  name: telnetmode=
- !ruby/object:RI::MethodSummary 
  name: waitfor
- !ruby/object:RI::MethodSummary 
  name: write
name: Telnet
superclass: SimpleDelegator

?>