Problems with a simple script
| From: | FPU dot WHITES1 at FRIENDSPROVIDENT dot CO dot UK | Date: | Tue, 30 Oct 2001 17:30:27 +0000 |
| Subject: | Problems with a simple script | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-10111@lists.php.net to get a copy of this message | ||
--- Received from FPU.WHITES1 799 3703 30-10-01 17:28
-> IN=php-windows@lists.php.net
I tried this from C++ once a couple of years ago and had the same problem.
Wait until you get that bit working, then you'll find that sometimes windows
caches network connection information, and even when the box at the other
end is back up again the connection still fails for an hour 8-)
<bows_head_in_shame>
To get it working in the end I shelled out to the real PING program, piped
the output to a file, and just checked it for the text "Reply from". Sad I
know but it DID WORK! 8-)
</bows_head_in_shame>
-Steve
----------------------------------------------------------------------------
From: mstew@one.net
To: php-windows@lists.php.net
Date: Tue, 30 Oct 2001 11:24:11 -0500
Subject: [PHP-WIN] Problems with a simple script
I put together this simple script but seem to be having problems with it.
All the script does is ping an IP addy and then replies back if it is up or
down. The problem is with the fsockopen command. It seems if the IP is up it
works fine, only when the IP is offline does it hang at that point in the
script. It will hang forever at this point or until the default timeout (30
sec.) in the php.ini file. Does anyone no of a fix or a work around for
this? Thanks for the help!
#!c:\php
<?
$description_x = "11.64.68.162";
$port_x = "7";
$ptime_x = "10";
$status1 = "UP";
$status2="$description_x unreachable";
$file = fsockopen($description_x,$port_x,$errno,$errstr,$ptime_x);
if (!$file)
//Used for debugging
echo "$status1";
else
echo "$status2";
//end debugging
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
This e-mail may contain confidential information and/or copyright
material. This e-mail is intended for the use of the addressee
only. Any unauthorised use may be unlawful.
If you receive this e-mail by mistake please advise the sender
immediately by using the reply facility in your e-mail software.
Friends Provident Marketing Group consists of the following
companies:
Friends Provident Life and Pensions Limited.
Registered number 4096141.
Friends' Provident Unit Trust Managers Limited.
Registered number 970641
FP Life Assurance Limited.
Registered number 782698
Friends Provident Pensions Limited.
Registered number 475201
Friends Ivory & Sime Managed Pensions Funds Limited.
Registered number 1020044
Registered and Head Office of each of the above companies is at Pixham End,
Dorking, Surrey RH4 1QA.
Registered in England. Incorporated companies limited by shares.
Ivory & Sime Trustlink Limited. Registered number 151198
Registered and Head Office: One Charlotte Square, Edinburgh EH2
4DZ. Registered in Scotland. Incorporated company limited by
shares.
Companies within this Group transact life assurance, pension,
permanent health, unit trust and investment trust business
All are regulated by the Personal Investment Authority.
Friends' Provident Unit Trust Managers Limited is also regulated
by IMRO.