This post was last edited by jdgdf566 on 2013-08-30 17:41:37
Socket
/* Open a server socket to port 1234 on localhost */$server = stream_socket_server (' tcp://127.0.0.1:12345 '); $socket = Stre Am_socket_accept ($server); /* Grab a packet (is a typical MTU size) of OOB data */ echo "Received out-of-band: '". Stream_socket_recvfrom ($socket, Stream_oob). "' \ n"; /* Take a peek at the normal in-band data, but don ' t comsume it. * /echo "Data: '". Stream_socket_recvfrom ($socket, Stream_peek). "' \ n"; /* Get The exact same packet again, but remove it from the buffer this time. * /echo "Data: '". Stream_socket_recvfrom ($socket, 1500). "\ n";/* Close it Up */fclose ($socket); fclose ($server);
PHP warning:stream_socket_accept (): Accept failed: The connection attempt failed because the connecting party did not respond correctly after a period of time or the connected host was unresponsive.
There is no such problem under Apache.
Reply to discussion (solution)
Has the firewall released PHP yet?
Has the firewall released PHP yet? No firewall installed.
Do not know, your error message is timed out, is not connected
Check the $errno.
Do not know, your error message is timed out, is not connected
Check out that $errno really is a timeout. Stream_socket_accept ($server) is not an infinite time when the second parameter is 0. This function should be used in the loop structure. The preliminary conclusion is this.