Seite 1 von 1

[PHP] fsockopen immer "true"

Verfasst: 11.06.2007 21:56
von warefare.net
ja wie bereits im titel erwähnt habe ich ein problem mit fsockopen:

Code: Alles auswählen

$ip = "udp://TESTIPHIERHIN";
$port = "80";
$timeout = "1";
    $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
    if(!$fp)
    {
        $status = "off";
    }
    else
    {
        $status = "on";
        fclose($fp);
    }

echo $status . "<br />";
damit wollte ich eigentlich nur den status von einem server überprüfen ..
allerdings gibt fsockopen mir immer egal bei welcher angabe (auch wenn der server mit sicherheit off ist) true bzw on zurück

hat wer ne ahnung woran das liegen könnte ?

Verfasst: 11.06.2007 22:43
von Jensemann
Das ist ein bekanntes Problem, meldet sich gelegentlich mit der Meldung E_DOKU_NICHT_GELESEN.
UDP sockets will sometimes appear to have opened without an error, even if the remote host is unreachable. The error will only become apparent when you read or write data to/from the socket. The reason for this is because UDP is a "connectionless" protocol, which means that the operating system does not try to establish a link for the socket until it actually needs to send or receive data.