Re[2]: [PHP-WIN] Ping!
| From: | Gonzalo Vera | Date: | Fri, 06 Oct 2000 02:19:12 +0000 |
| Subject: | Re[2]: [PHP-WIN] Ping! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2976@lists.php.net to get a copy of this message | ||
Oh well, form John T.'s and Jason B.'s answers I get it that it won't
be that easy.
I hadn't checked the "sockets" functions that Jason points out
(another reason to download the manual more frequently...), but I
don't have a compiler (and really don't know how to compile). I think
I'll have to go for the platform dependent "ping" way.
Strange enough, the manual (online, not mine...) explains how to open
an UDP socket, so I tried opening one to port 139 on some machines,
and always get a "true" result, even if the computer doesn't exist.
Funny, why does it allways return true? That would be a solution, if I
could get it to work. This is what I'm trying:
$host="udp://192.168.220.108";
$port=139;
$s=fsockopen($host,$port);
if (!$s) {
echo "Not here";
} else {
echo "I'm here";
}
fclose($s);
Any ideas?
Gonzalo.
> Did you check here?
> http://www.php.net/manual/ref.sockets.php
> jason
>> I've checked both ping C source code and PHP4 manual.
>> ICMP packets can only be sent through a RAW socket.
>> PHP only allows to open standard TCP sockets.
>> So it'll be hard to make it send ICMP packets :(
>> But you can still build your php extension which will support this, if
> you
>> want it ... ;oD
>>
>> Cheers,
>> John.