title: Setting a socket timeout in PHP
body: <p>I'm writing a script in PHP that uses PEAR's <a href="https://pear.php.net/manual/en/package.networking.net-socket.php" rel="nofollow">Net_Socket</a>. I want to query servers to see if they have any current information. I send in a command and then use $socket->readLine() to get the response. However, if there is not a response, my script just waits forever. Is there anyway to either tell the socket to close after a specific amount of time or to wrap the whole function in a timeout, that if it hasn't returned by the timeout, it halts its execution?</p>