note 80524 added to function.socket-set-option

From: Date: Sun, 20 Jan 2008 17:38:28 +0000
Subject: note 80524 added to function.socket-set-option
Groups: php.notes 
Request: Send a blank email to php-notes+get-135260@lists.php.net to get a copy of this message
TOO BAD Example! if (!socket_bind($socket, '127.0.0.1', 1223)) { echo 'Unable to bind socket: '. socket_strerror(socket_last_error()) . PHP_EOL; } $rval = socket_get_option($socket, SOL_SOCKET, SO_REUSEADDR); I'm spend very much time to found wat I'm doing wrong. http://www.unixprogram.com/socket/socket-faq.html#faq44 5. What exactly does SO_REUSEADDR do? This socket option tells the kernel that even if this port is busy (in the TIME_WAIT state), go ahead and reuse it anyway. If it is busy, but with another state, you will still get an address already in use error. It is useful if your server has been shut down, and then restarted right away while sockets are still active on its port. You should be aware that if any unexpected data comes in, it may confuse your server, but while this is possible, it is not likely. SO_REUSEADDR MUST CALLED BEFORE BIND else if port is busy bind will not be processed... give me back my years.... ) ---- Server IP: 195.54.192.44 Probable Submitter: 212.23.71.141 ---- Manual Page -- http://www.php.net/manual/en/function.socket-set-option.php Edit -- https://master.php.net/note/edit/80524 Del: integrated -- https://master.php.net/note/delete/80524/integrated Del: useless -- https://master.php.net/note/delete/80524/useless Del: bad code -- https://master.php.net/note/delete/80524/bad+code Del: spam -- https://master.php.net/note/delete/80524/spam Del: non-english -- https://master.php.net/note/delete/80524/non-english Del: in docs -- https://master.php.net/note/delete/80524/in+docs Del: other reasons-- https://master.php.net/note/delete/80524 Reject -- https://master.php.net/note/reject/80524 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135260) next »