🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #13091

Re: Como saber si un ordenador est� accesible con perl

#13091
From: scoope
Date: Tue, 27 Mar 2001 13:31
43 lines
2383 bytes
TvX en portatil <Tovaritx@mi28.tovaritx.red> wrote:

Apunta...

------------------------------------
#!/usr/bin/perl

use IO::Socket;

print "Comprobar IP?\n";
$ip=<STDIN>;
print "Puerto?\n";
$puerto=<STDIN>;

$pwd= IO::Socket::INET -> new (
                Timeout => "3",
                PeerAddr=> "$ip\:$puerto");

if ($pwd) {print "Activo!\n";}
else {print "El puerto $puerto de la aquina $ip esta cerrado.\n";}

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


Espero que te valga....solo tienes que usar el modulo IO:Socket.



> Hola,
> necesito saber si un ordenador est� accesible via red desde un script de
> perl ya que de �l me bajo el correo con dicho script y la comprobaci�n
> se alarga innecesariamente cuando no hay conexi�n...

> Saludines y muchas gracias por la atenci�n
> -- 
> --------------------------------------------------------------
> |    \|/ En breve: "La cocina de la Vir"...  _O)   __/\__    |
> |   (.~.)            #19043                  /\\   \    /    |
> |__oO(_)Oo__ ___    ____ ____  ___           \_V   /_/\_\    |
> |\__    ___/ \   \ /   / \   \/  / Internautas del mundo,    |
> |  |    |     \   Y   /   \     /        �Unios!             |
> |  |____|       \___/     /__/\ \ <NospaMvirginia1@iname.com>|
> ------------------------------\/------------------------------
Technical Details
Message-ID: <99q4mp$cm4$1@hal.scoope.org>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!hal.scoope.org!not-for-mail
References: <slrn9c0jsk.sb.Tovaritx@mi28.tovaritx.red>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,66b5c68cb2691b58
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-03-27 06:30:05 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!hal.scoope.org!not-for-mail
From: scoope@hispavista.com
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Como saber si un ordenador est� accesible con perl
Date: 27 Mar 2001 13:31:05 GMT
Organization: ScOoPe MaNiAc'S News Server
Lines: 43
Message-ID: <99q4mp$cm4$1@hal.scoope.org>
References: <slrn9c0jsk.sb.Tovaritx@mi28.tovaritx.red>
NNTP-Posting-Host: 213.96.132.220
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: hal.scoope.org 985699865 12996 192.168.0.2 (27 Mar 2001 13:31:05 GMT)
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (Linux/2.2.18 (i686))