note 23668 added to function.socket-connect
| From: | logan at voerthegame dot com | Date: | Wed, 24 Jul 2002 15:24:09 +0000 |
| Subject: | note 23668 added to function.socket-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33505@lists.php.net to get a copy of this message | ||
I had the same problem with the timeout, and i applied this solution.
It works only on linux PHP, i make a ping to the ip before connect the socket.....
$address = gethostbyname ($ip);
$command = "ping -c 1 " . $address;
$r = exec($command);
if ($r[0]=="r")
{
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror ($socket) .
"\n";
} else {
echo "OK.\n";
}
--
http://www.php.net/manual/en/function.socket-connect.php
http://master.php.net/manage/user-notes.php?action=edit+23668
http://master.php.net/manage/user-notes.php?action=delete+23668
http://master.php.net/manage/user-notes.php?action=reject+23668