Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4076318
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:24:35+00:00 2026-05-20T17:24:35+00:00

I am studying for the PHP 5 Certification exam. This function was mentioned in

  • 0

I am studying for the PHP 5 Certification exam. This function was mentioned in the practice exams.

function stream_set_blocking():

Sets blocking or non-blocking mode on
a stream.

This function works for any stream
that supports non-blocking mode
(currently, regular files and socket
streams).

From both a high-level and low-level perspective, how do blocking mode and non-blocking mode streams behave in PHP? What i a socket stream and a non-socket stream? Examples are appreciated.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:24:36+00:00Added an answer on May 20, 2026 at 5:24 pm

    The blocking/non-blocking mode says if the fread/fwrite functions will return immediately. When in non-blocking mode, they will return any available data. If no data can be read at the time the function is invoked, then none will be returned. Such streams are typicalled polled in a loop.

    In blocking mode however, the function will always wait (and therefore block your programs execution) until it can satisfy the complete read request. If you ask to read 1MB from a network socket, the function will not return until it has received 1MB to pass on.

    I think Wikipedia covers it quite well:
    http://en.wikipedia.org/wiki/Berkeley_sockets#Blocking_vs._non-blocking_mode

    It mostly has effect on networked file/stream sources. For local filesystems the operating system will always read the desired length of data. PHP also has stream wrappers, which can handle that option at their discretion (there’s no reliable general rule).

    For more low-level details, visit the manpages of fnctl(2) or socket(2) or
    http://www.scottklement.com/rpg/socktut/nonblocking.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm studying this code: http://www.w3style.co.uk/a-lightweight-and-flexible-front-controller-for-php-5 In it the author uses a static function to
I'm studying for the Zend PHP certification . I am not sure about the
While studying for the Zend PHP Exam I came across the following contradicting information:
I am studying sort_flags at this page on PHP Manual. And I don't understand
I just saw this code while studying the wordpress source code (PHP), You can
I am studying PHP,OOP and i am at Static, At this php.net/static i didnt
I'm studying high-performance coding for websites in PHP, and this idea popped into my
I was studying Ray Tracing on http://www.devmaster.net/articles/raytracing_series/part1.php when I came across this piece of
I'm studying http://www.php.net/manual/en/function.dns-get-record.php and there seems to be no option to set a custom
Im studying for finals and i came across this question: write a PHP script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.