Repository URL to install this package:
| 
      
     
      
        
        
        Version: 
        
         
  
        
    
          
          2.2.2-1  ▾
        
         
  
      
        
      
  
      
  
     | 
U:RDoc::AnyMethod[iI"new:ETI"Net::Telnet::new;FT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"&Creates a new Net::Telnet object.;To:RDoc::Markup::BlankLine o; ; [ I"AAttempts to connect to the host (unless the Proxy option is ;TI"Bprovided: see below). If a block is provided, it is yielded ;TI"Astatus messages on the attempt to connect to the server, of ;TI"the form:;T@o:RDoc::Markup::Verbatim; [I"Trying localhost... ;TI"Connected to localhost. ;T:@format0o; ; [I"B+options+ is a hash of options. The following example lists ;TI"*all options and their default values.;T@o;; [I"host = Net::Telnet::new( ;TI"C "Host" => "localhost", # default: "localhost" ;TI": "Port" => 23, # default: 23 ;TI"= "Binmode" => false, # default: false ;TI"G "Output_log" => "output_log", # default: nil (no output) ;TI"G "Dump_log" => "dump_log", # default: nil (no output) ;TI"D "Prompt" => /[$%#>] \z/n, # default: /[$%#>] \z/n ;TI"< "Telnetmode" => true, # default: true ;TI": "Timeout" => 10, # default: 10 ;TI"A # if ignore timeout then set "Timeout" to false. ;TI"9 "Waittime" => 0, # default: 0 ;TI"; "Proxy" => proxy # default: nil ;TI"B # proxy is Net::Telnet or IO object ;TI" ) ;T; 0o; ; [I"-The options have the following meanings:;T@o:RDoc::Markup::List: @type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I" Host;T; [o; ; [I"Hthe hostname or IP address of the host to connect to, as a String. ;TI"Defaults to "localhost".;T@o;;[I" Port;T; [o; ; [I"-the port to connect to. Defaults to 23.;T@o;;[I"Binmode;T; [o; ; [I"@if false (the default), newline substitution is performed. ;TI"Outgoing LF is ;TI"Bconverted to CRLF, and incoming CRLF is converted to LF. If ;TI"?true, this substitution is not performed. This value can ;TI"2also be set with the #binmode() method. The ;TI"Boutgoing conversion only applies to the #puts() and #print() ;TI">methods, not the #write() method. The precise nature of ;TI"Cthe newline conversion is also affected by the telnet options ;TI"SGA and BIN.;T@o;;[I"Output_log;T; [o; ; [I">the name of the file to write connection status messages ;TI";and all received traffic to. In the case of a proper ;TI";Telnet session, this will include the client input as ;TI"<echoed by the host; otherwise, it only includes server ;TI";responses. Output is appended verbatim to this file. ;TI"'By default, no output log is kept.;T@o;;[I" Dump_log;T; [o; ; [I"Aas for Output_log, except that output is written in hexdump ;TI"?format (16 bytes per line as hex pairs, followed by their ;TI"<printable equivalent), with connection status messages ;TI"8preceded by '#', sent traffic preceded by '>', and ;TI"Areceived traffic preceded by '<'. By default, not dump log ;TI" is kept.;T@o;;[I"Prompt;T; [o; ; [ I"Ba regular expression matching the host's command-line prompt ;TI"@sequence. This is needed by the Telnet class to determine ;TI"Awhen the output from a command has finished and the host is ;TI"?ready to receive a new command. By default, this regular ;TI" expression is /[$%#>] \z/n.;T@o;;[I"Telnetmode;T; [o; ; [I"8a boolean value, true by default. In telnet mode, ;TI":traffic received from the host is parsed for special ;TI"8command sequences, and these sequences are escaped ;TI"8in outgoing traffic sent using #puts() or #print() ;TI";(but not #write()). If you are using the Net::Telnet ;TI"8object to connect to a non-telnet service (such as ;TI"<SMTP or POP), this should be set to "false" to prevent ;TI"<undesired data corruption. This value can also be set ;TI"!by the #telnetmode() method.;T@o;;[I"Timeout;T; [o; ; [I">the number of seconds to wait before timing out both the ;TI"?initial attempt to connect to host (in this constructor), ;TI"Dwhich raises a Net::OpenTimeout, and all attempts to read data ;TI"Dfrom the host, which raises a Net::ReadTimeout (in #waitfor(), ;TI">#cmd(), and #login()). The default value is 10 seconds. ;TI"AYou can disable the timeout by setting this value to false. ;TI"?In this case, the connect attempt will eventually timeout ;TI"6on the underlying connect(2) socket call with an ;TI"<Errno::ETIMEDOUT error (but generally only after a few ;TI"=minutes), but other attempts to read data from the host ;TI"6will hang indefinitely if no data is forthcoming.;T@o;;[I" Waittime;T; [o; ; [I"?the amount of time to wait after seeing what looks like a ;TI"<prompt (that is, received data that matches the Prompt ;TI"=option regular expression) to see if more data arrives. ;TI"@If more data does arrive in this time, Net::Telnet assumes ;TI"Bthat what it saw was not really a prompt. This is to try to ;TI"?avoid false matches, but it can also lead to missing real ;TI"?prompts (if, for instance, a background process writes to ;TI";the terminal soon after the prompt is displayed). By ;TI":default, set to 0, meaning not to wait for more data.;T@o;;[I" Proxy;T; [o; ; [I"Ca proxy object to used instead of opening a direct connection ;TI"@to the host. Must be either another Net::Telnet object or ;TI">an IO object. If it is another Net::Telnet object, this ;TI"Cinstance will use that one's socket for communication. If an ;TI"BIO object, it is used directly for communication. Any other ;TI"5kind of object will cause an error to be raised.;T: @fileI"lib/net/telnet.rb;T:0@omit_headings_from_table_of_contents_below00I" mesg;F[ I"(options);T@©FI"Telnet;FcRDoc::NormalClass00