SOCKET_SET_BLOCK(3) 1 SOCKET_SET_BLOCK(3)socket_set_block - Sets blocking mode on a socket resourceSYNOPSIS
bool socket_set_block (resource $socket)
DESCRIPTION
The socket_set_block(3) function removes the O_NONBLOCK flag on the socket specified by the $socket parameter.
When an operation (e.g. receive, send, connect, accept, ...) is performed on a blocking socket, the script will pause its execution until
it receives a signal or it can perform the operation.
PARAMETERS
o $socket
- A valid socket resource created with socket_create(3) or socket_accept(3).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
socket_set_block(3) example
<?php
$socket = socket_create_listen(1223);
socket_set_block($socket);
socket_accept($socket);
?>
This example creates a listening socket on all interfaces on port 1223 and sets the socket to O_BLOCK mode. socket_accept(3) will
hang until there is a connection to accept.
SEE ALSO socket_set_nonblock(3), socket_set_option(3).
PHP Documentation Group SOCKET_SET_BLOCK(3)
Check Out this Related Man Page
SOCKET_ACCEPT(3) 1 SOCKET_ACCEPT(3)socket_accept - Accepts a connection on a socketSYNOPSIS
resource socket_accept (resource $socket)
DESCRIPTION
After the socket $socket has been created using socket_create(3), bound to a name with socket_bind(3), and told to listen for connections
with socket_listen(3), this function will accept incoming connections on that socket. Once a successful connection is made, a new socket
resource is returned, which may be used for communication. If there are multiple connections queued on the socket, the first will be used.
If there are no pending connections, socket_accept(3) will block until a connection becomes present. If $socket has been made non-blocking
using socket_set_blocking(3) or socket_set_nonblock(3), FALSE will be returned.
The socket resource returned by socket_accept(3) may not be used to accept new connections. The original listening socket $socket, how-
ever, remains open and may be reused.
PARAMETERS
o $socket
- A valid socket resource created with socket_create(3).
RETURN VALUES
Returns a new socket resource on success, or FALSE on error. The actual error code can be retrieved by calling socket_last_error(3). This
error code may be passed to socket_strerror(3) to get a textual explanation of the error.
SEE ALSO socket_connect(3), socket_listen(3), socket_create(3), socket_bind(3), socket_strerror(3).
PHP Documentation Group SOCKET_ACCEPT(3)
Excuse me . I'm a beginner . In windows , MFC can be used , but how to do in Unix ? And does unix support c++like VC++ ? How can I get developing tools in Unix ? (7 Replies)
hi
i have a server socket programme which is running in HP/UX system and
then need to add a function about refreshing memory every miniute
because the socket programme is blocked , i have no idea about this
what should i do
thanks (10 Replies)
my system is a stand alone system... i want to try doing socket porgramming..ihave heard that this is usually done during testing...
how can i do that....? (6 Replies)
Well, I am not even sure if its failing, cause at the other end I have a select call and it wakes up and reads the data I sent fine.
Ok here is the issue, I have a UDP socket(non blocking) through which I push some data to another port. At the other end I have select loop, waiting for this data.... (6 Replies)
hello socket programming expert,
I having difficulties in understanding how select() function in socket programming work.... I'm trying to create my own peer-to-peer chat or file transfer program by using the select() function.... Therefore does anyone had any tutorial or source code that... (4 Replies)
Hi there, a newbie as far as compiling c.
I have a problem, I've ported a fairly simple perl socket program over to c.
I compiled it as follows
cc simplesocket.c -lsocket -lnsl
compiles great, no errors.
When I launch it from the command line, it works great!!!!
However, if I... (5 Replies)
I have written a flash socket security file server in PHP. The basic idea is that when Flash Player connects via socket to a server, the first thing it does is connect to port 843 and send a request for a 'socket policy file' by sending the string <policy-file-request/>.
The problem I have is... (5 Replies)
Hello experts,
four machines need to communicate with each other. How can I start the socket programming. Can you please explain me more elaborated way.
Thank you for your time and effort in advance (4 Replies)
Hello,
I'm doing a very simple program which reads a file and sends whatever is in the file through a socket. Like the program "file2cable".
Let's say i have a file containing the following, which is a hex dump of an ARP request frame:
ff ff ff ff ff ff 00 1b 24 79 5a 73 08 06
00 01 08... (5 Replies)
Sorry if I posted 2 separate questions.
I'm currently doing socket programming on my current task. As you can see below in the client side. I've tried to do a loop so I will be able to get prompt for input over and over again.
This is the code.
do{
printf("Please your name > ");... (10 Replies)
Hai every one ,,,
I am runinng one tcp socket in non-blocking mode. In the connect state(operation in progress) if the server is not running ,client socket select will give success.
FD_ISSET(socketfd,&wfd) will give me succes always and am getting wfd value as 16. I tried with blocking... (6 Replies)
will there be any unexpected results on looping connect call for a non blocking socket to determine the connection based on error code. I am getting connection unsuccessful intermittently and so wondering whether is the timeout 500 millisec not sufficient or looping connect cause any unexpected.
... (7 Replies)
I have file A.txt
A 1023
B 123
C 1223
I want output
Hello_12PM_A 1023
Hello_12PM_B 123
Helll_12PM_C 1223
Add Hello and time stamp in AM and PM. (4 Replies)
Hello,
I have a question about socket programming
The question was a homework of this university of past (2011?) course.
The server is simulating a sensor that provides readings of temperature, light and humidity (temp.dat, light.dat, humid.dat) each with single column of number, one per row. ... (6 Replies)