Hi Franken

Thank you very much.This is working.
One more Information I need ,Please see it.

This is testing ports by telnetting to the ports.But in doin so it real for
25 port only.For remaining ports ,its failed,that means Even though PORT is
opened ,TELNET is not able to Open. 

Is there any way that I can know the port status,whether it is active or not

Thank you very much.

With Regards
Rajuveea 

> ----------
> From:         Johannes Franken[SMTP:[EMAIL PROTECTED]]
> Sent:         Saturday, February 23, 2002 4:24 PM
> To:   [EMAIL PROTECTED]
> Cc:   [EMAIL PROTECTED]
> Subject:      Re: net::telnet
> 
> On Sat, Feb 23, 2002 at 02:13:27PM +0530, Veeraraju_Mareddi wrote:
> > Please see the code here.  But This program terminates if one of
> > them is Failed.  
> 
> It terminates because Net::Telnet->Errmode defaults to 'die'.
> You should really set it to 'return'. 
> But there are lots of other bugs in your code...
> 
> > Is there any way to get it done.
> 
> sure:
> 
> > --------------------------------------------------------------------
> > use Net::Telnet;
> > $telnet = new Net::Telnet(Port => 25);
>                                       ^ insert ,Errmode=>'return'
>                                     before the closing bracket 
> > $result ='Active';
> move this line to the top of the loop block, otherwise the first
> negative server would affect all later ones.
> 
> > @hosts=('208.220.254.1',208.220.254.2',208.220.254.3');
>    insert single quotes   ^here and      ^here
>    
> > foreach $host(@hostes){
>                      ^ delete one letter e here
>                    
> > $telnet->open($host) or $result ='Not Active';
> > print " 25 port on $host is $result\n";
> > }
> 
> > $telnet->close;
> move this line at bottom of the loop block
> 
> > --------------------------------------------------------------------
> Summarizing, what you get is:
> 
> use Net::Telnet;
> $telnet = new Net::Telnet(Port => 25, Errmode=>'return',Timeout=>1);
> @hosts=('208.220.254.1','208.220.254.2','208.220.254.3');
> foreach $host(@hosts){
>       $result ='Active';
>       $telnet->open($host) or $result ='Not Active';
>       print " 25 port on $host is $result\n";
>       $telnet->close;
> }
> 
> -- 
> Johannes Franken
>  
> Professional unix/network development
> mailto:[EMAIL PROTECTED]
> http://www.jfranken.de/
> 
************************************************************************** 
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to