stream_set_timeout

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

stream_set_timeoutSet timeout period on a stream

Beschreibung

stream_set_timeout(resource $stream, int $seconds, int $microseconds = 0): bool

Sets the timeout value on stream, expressed in the sum of seconds and microseconds.

When the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data() is set to true, although no error/warning is generated.

Parameter-Liste

stream

The target stream.

seconds

The seconds part of the timeout to be set.

microseconds

The microseconds part of the timeout to be set.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

Beispiel #1 stream_set_timeout() example

<?php
$fp 
fsockopen("www.example.com"80);
if (!
$fp) {
    echo 
"Unable to open\n";
} else {

    
fwrite($fp"GET / HTTP/1.0\r\n\r\n");
    
stream_set_timeout($fp2);
    
$res fread($fp2000);

    
$info stream_get_meta_data($fp);
    
fclose($fp);

    if (
$info['timed_out']) {
        echo 
'Connection timed out!';
    } else {
        echo 
$res;
    }

}
?>

Anmerkungen

Hinweis:

This function doesn't work with advanced operations like stream_socket_recvfrom(), use stream_select() with timeout parameter instead.

This function was previously called as set_socket_timeout() and later socket_set_timeout() but this usage is deprecated.

Siehe auch

  • fsockopen() - Stellt eine Internet- oder Unix-Domain-Socket-Verbindung her
  • fopen() - Öffnet eine Datei oder URL

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

FULLLZ.ASIA ✅ sells Cloned card including Pin Verify Code Cashout From ATM

FULLLZ.ASIA ✅ Sells ATM Skimmer POS/x2 EMV/DUMPS PIN/OMIKEY/Track+1/2_Zip_state+TX+NJ+CA+NY FULLLZ.ASIA ✅ Verify Seller Dumps Pin track1&2,Pay ...

Geschrieben von dumpstop10 am 13.06.2026 02:36:46
Forum: SEO - Suchmaschinen Tricks und Tipps
FULLLZ.ASIA ✅ includes full info ssn,dob,ssn,dl/social security number/date

FULLLZ.ASIA ✅ Sells ATM Skimmer POS/x2 EMV/DUMPS PIN/OMIKEY/Track+1/2_Zip_state+TX+NJ+CA+NY FULLLZ.ASIA ✅ Verify Seller Dumps Pin track1&2,Pay ...

Geschrieben von dumpstop10 am 13.06.2026 02:34:57
Forum: Provider / Domains
FULLLZ.ASIA ✅ purchase Cashapp/Paypal DUMPS with PINs, EBTs with PINs,

FULLLZ.ASIA ✅ Sells ATM Skimmer POS/x2 EMV/DUMPS PIN/OMIKEY/Track+1/2_Zip_state+TX+NJ+CA+NY FULLLZ.ASIA ✅ Verify Seller Dumps Pin track1&2,Pay ...

Geschrieben von dumpstop10 am 13.06.2026 02:34:24
Forum: Entwicklungsumgebungen
FULLLZ.ASIA ✅ DUMPS WITH PIN SHOP ONLINE+TRACK 1&2 MIX 101

FULLLZ.ASIA ✅ Sells UK SQL Data NIN/National Insurance Number/DOB/Sortcode/BankNum FULLLZ.ASIA ✅ worldwide Dumps With Pin Track 1&2 track1 %B4 ...

Geschrieben von dumpstop10 am 12.06.2026 15:06:22
Forum: Jobgesuche