Re: Re: Ping

From: Date: Fri, 06 Oct 2000 14:51:11 +0000
Subject: Re: Re: Ping
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3013@lists.php.net to get a copy of this message
I still can't get it to work as expected: -If the computer is on, it works like a charm. -If the computer is off, but exists in DNS/hosts, the script is timeouted. -If the computer doesn't exist in the DNS/hosts, the script is timeouted. I even tried setting the fsockopen timeout to a few seconds, but it still gets a script timeout with an php error. I can't seem to be able to block a fsockopen attempt to an inexistent/offline computer, which would be the answer to my problems. -If the computer exists, and is online, but has the fix to hide port 139 (thus avoiding nukeing DoS attacks), the script answers that the computer is NOT online. Do you get the same result? Gonzalo. > At 15:10 06/10/00 +0200, Rygars wrote: > I have tested it on my network (linux[samba installed]+win95+win98+winnt+win2k) and it works. > All the OS answered correctly to the script. I am not sure if samba was the cause of linux answer > but > it worked alright. I will post later the entire script as I am working now on it to give it a > nice face. > BTW... I have run the script both from linux and win2k (not tested on winnt and win9x) and it > works fine with one note... from linux the script is faster (10-20 times faster). >>At 11:01 06/10/00 +0200, you wrote: >>><?php >>>$host="192.168.220.108"; >>>$port=139; >>>$s=fsockopen($host,$port); >>>if(!$s){ >>> echo "$host is NOT online.<BR>"; >>>}else{ >>> echo "$host is online.<BR>"; >>>} >>>@fclose($s); >>>?> >>> >>>This should work. It works for me [Win2k, Apache 1.3.12, PHP 4.0.2-dev]. >> >>It'll work only for windows based target machines (or other ones who listen >>on port 139 (netbios)) >>It's not a real ping :( >>But it should still be suitable for windows networks ... >> >>Cheers, >>John. >> >> >>

« previous php.windows (#3013) next »