note 54706 deleted from function.socket-set-option by tularis

From: Date: Wed, 13 Jul 2005 08:41:24 +0000
Subject: note 54706 deleted from function.socket-set-option by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-91876@lists.php.net to get a copy of this message
Note Submitter: luzhongda at ysh dot com dot cn Reason: added to the manual ---- When the options in the following code are set, the error messge is displayed: E_WARNING: socket_read() unable to read from socket [4]: Interrupted system call in /root/socket.php on line 390 The source code is: function connect() { $result = false; /* Create a TCP/IP socket. */ $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->socket==false) { $this->_logger->debug( "socket_create() failed\n"); } else { $this->_logger->debug( "The socket is created.\n"); } $result = socket_connect($this->socket, $this->ipAddress, $this->port); if ($result == false) { $this->_logger->debug( "socket_connect() failed \n"); $result = false; $this->socket = null; } else { socket_set_option($this->socket,SOL_SOCKET, SO_KEEPALIVE, 1); socket_set_option($this->socket,SOL_SOCKET, SO_RCVTIMEO, array("sec"=>3, "usec"=>0)); socket_set_option($this->socket,SOL_SOCKET, SO_SNDTIMEO, array("sec"=>3, "usec"=>0)); socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1); $result = true; } return $result; }

« previous php.notes (#91876) next »