note 22200 added to function.socket-bind
| From: | keksov@php.net | Date: | Mon, 10 Jun 2002 15:22:22 +0000 |
| Subject: | note 22200 added to function.socket-bind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31663@lists.php.net to get a copy of this message | ||
If you want to reuse address and port, and get rid of error: unable to bind, address already in use,
you have to use socket_setopt (check actual spelling for this function in you PHP verison) before
calling bind:
if (!@socket_setopt($sock,SOL_SOCKET,SO_REUSEADDR,1)) {
echo "socket_setopt() failed: reason:
".socket_strerror(socket_last_error($sock))."\n";
exit;
}
This solution was found by
Christophe Dirac. Thank you Christophe!
--
http://www.php.net/manual/en/function.socket-bind.php
http://master.php.net/manage/user-notes.php?action=edit+22200
http://master.php.net/manage/user-notes.php?action=delete+22200
http://master.php.net/manage/user-notes.php?action=reject+22200