_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { return false; } foreach ($ports as $p) { if (@socket_bind($this->_sock, $address, (int) $p) === false) { continue; } else { $port = $p; break; } } if ($port == 0) return false; if (@socket_listen($this->_sock, 5) === false) { return false; } return $port; } /** * Release locker */ public function unlock() { if ($this->_sock !== false) @socket_close($this->_sock); } } // End ^ LF ^ UTF-8