Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

stream_set_blocking(3) [php man page]

STREAM_SET_BLOCKING(3)							 1						    STREAM_SET_BLOCKING(3)

stream_set_blocking - Set blocking/non-blocking mode on a stream

SYNOPSIS
bool stream_set_blocking (resource $stream, int $mode) DESCRIPTION
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). PARAMETERS
o $stream - The stream. o $mode - If $mode is 0, the given stream will be switched to non-blocking mode, and if 1, it will be switched to blocking mode. This affects calls like fgets(3) and fread(3) that read from the stream. In non-blocking mode an fgets(3) call will always return right away while in blocking mode it will wait for data to become available on the stream. RETURN VALUES
Returns TRUE on success or FALSE on failure. NOTES
Note This function was previously called as set_socket_blocking(3) and later socket_set_blocking(3) but this usage is deprecated. SEE ALSO
stream_select(3). PHP Documentation Group STREAM_SET_BLOCKING(3)

Check Out this Related Man Page

io_nonblock(3)						     Library Functions Manual						    io_nonblock(3)

NAME
io_nonblock - switch to non-blocking I/O SYNTAX
#include <io.h> void io_nonblock(int64 fd); DESCRIPTION
io_nonblock puts UNIX descriptor fd into ``non-blocking mode.'' Calling io_nonblock(fd) before io_fd(fd) makes io_tryread and io_trywrite faster and more efficient. Actually, current UNIX kernels do not support non-blocking descriptors; they support non-blocking open files. Furthermore, many programs will break if they encounter non-blocking mode. This means that you must not use io_nonblock for a descriptor inherited from another pro- gram. io_nonblock has no return value; it always succeeds. If d is not the number of a UNIX descriptor, io_nonblock has no effect. If io_fd is given a descriptor in blocking mode, io_tryread and io_trywrite go through the following contortions to avoid blocking: 1 Stop if poll says that the descriptor is not ready. Otherwise there's a good chance, but not a guarantee: even if poll says the descrip- tor is ready, the descriptor might not be ready a moment later. (Furthermore, poll can fail on some systems.) 2 Catch SIGALRM. SIGALRM must not be blocked, and must not be used elsewhere in the program. 3 Set an interval timer so that any blocking call will be interrupted by SIGALRM within 10 milliseconds. (Current UNIX kernels do not allow any shorter interval.) Of course, this may still mean a 10-millisecond delay. If io_fd is given a descriptor in non-blocking mode (or a descriptor for a regular disk file), io_tryread and io_trywrite avoid these con- tortions. SEE ALSO
io_wait(3), io_canwrite(3) io_nonblock(3)
Man Page

15 More Discussions You Might Find Interesting

1. HP-UX

Intransient blocking page faults

Hi, Will anybody tell me what is this 'intransient blocking page faults' in HP-UX, it is in the structure _pst_vminfo in the header file /ust/include/sys/pstat/vm_pstat_body.h? (4 Replies)
Discussion started by: sushaga
4 Replies

2. IP Networking

Networking sysadmin/blocking/IM

What's the latest talk about instant messaging services in teh workplace, regarding blocking it, shutting off ports, etc? Is there a forum somewhere for this? Can't you shut down ports on linux or unix for IM services? (1 Reply)
Discussion started by: kymberm
1 Replies

3. Solaris

change priority of stream

Is it possible to change priority of stream process ? Original source: stream ./javawebserver Desired change is kind of: nice --10 of (stream ./javawebserver) (2 Replies)
Discussion started by: gogogo
2 Replies

4. Programming

questions about non-blocking read()

Hi, I need to read incoming data from a serial port. I also need the read() to be non-blocking, such that my program can then check for any data to be send via the serial port. I followed some FAQs on the net, set read() to be non-blocking, and got EAGAIN errors popping out. I realise that... (3 Replies)
Discussion started by: oddabe
3 Replies

5. UNIX for Dummies Questions & Answers

Retreiving live data

I have a stream of data come to a server and store in a file (datafile). This stream of data contain a lot of information. Data could come in every second or different frequency of times. I like to retrieve a certain text string as the data come in. All data information will come with the... (1 Reply)
Discussion started by: bobo
1 Replies

6. UNIX for Advanced & Expert Users

Doubt regarding Select()

Please provide the solution for the following scenario: 1) There are two process named as ProcessA and ProcessB 2) ProcessA has opend a named pipe in read mode.This has been made as blocking mode. 3) ProcessB opens this pipe and writes in Blocking mode.So wat happens is even if Process A goes... (2 Replies)
Discussion started by: sunil_ktg
2 Replies

7. Programming

Problem with fgets and rewind function ..

Hello Friends, I got stuck with fgets () & rewind() function .. Please need help.. Actually I am doing a like, The function should read lines from a txt file until the function is called.. If the data from the txt file ends then it goes to the top and then again when the function is called... (1 Reply)
Discussion started by: user_prady
1 Replies

8. Shell Programming and Scripting

Non-blocking pipe

Hello, Would this be an acceptable way of creating a non-blocking pipe. Basically I want to create kind of a server client arch. This code would be in the server, and I don't want to have to wait for clients to read before moving on to the next client. One problem I can see is if... (4 Replies)
Discussion started by: cdlaforc
4 Replies

9. Programming

socket function to read a webpage (socket.h)

Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct... #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <string.h> #include... (3 Replies)
Discussion started by: cyler
3 Replies

10. Programming

non blocking connect

OS : solaris 10 X86 I created stream socket, tries to connect to port 7 on the remote machine. After doing the non blocking connect call I did select with time out value is 3 secs. I am always getting timed out though I am writing prior to select. code: x=fcntl(S,F_GETFL,0);... (1 Reply)
Discussion started by: satish@123
1 Replies

11. UNIX for Advanced & Expert Users

What is the difference between single line mode and multiline mode in Regular expressions?

Hi All, Can please let me know what is the difference between the single line mode and multi line mode in regular expresions? Thanks, Chidhambaram B (3 Replies)
Discussion started by: chidhu.anu
3 Replies

12. Shell Programming and Scripting

How to get MD5 from a pipe stream and do not alter it?

Say I have a stream and want to get MD5 from it, without altering it. I won't know how big the stream is or how much time it will take to close. Here is the idea: cat somefile | calculate md5 and put it somewhere | bzip2 > somefile.bz2 (5 Replies)
Discussion started by: Tribe
5 Replies

13. Programming

Which are blocking and non-blocking api's in sockets in C ?

among the below socket programming api's, please let me know which are blocking and non-blocking. socket accept bind listen write read close (2 Replies)
Discussion started by: VSSajjan
2 Replies

14. HP-UX

From a C++ application how to find if a hpux host is in standard mode or trusted mode

is there a way for my C++ application to find out which mode the hpux OS is running in? standard mode or trusted mode. (3 Replies)
Discussion started by: einsteinBrain
3 Replies

15. Forum Support Area for Unregistered Users & Account Problems

Can't get past google verification

Trying to register the Verification step is blocking me. I've allowed all the intrusive Google trackers and Java. Tried different browsers with no blocking. Nothing is working. Says: "Try again later Your computer maybe ... " What weird is in this forum section I can pass the recaptcha but in... (1 Reply)
Discussion started by: Unregistered
1 Replies