public function bindSocket($uri)
    {
        $u = \PHPDaemon\Config\_Object::parseCfgUri($uri);
        $scheme = $u['scheme'];
        if ($scheme === 'unix') {
            $socket = new \PHPDaemon\BoundSocket\UNIX($u);
        } elseif ($scheme === 'udp') {
            $socket = new \PHPDaemon\BoundSocket\UDP($u);
            if (isset($this->config->port->value)) {
                $socket->setDefaultPort($this->config->port->value);
            }
        } elseif ($scheme === 'tcp') {
            $socket = new \PHPDaemon\BoundSocket\TCP($u);
            if (isset($this->config->port->value)) {
                $socket->setDefaultPort($this->config->port->value);
            }
        } else {
            Daemon::log(get_class($this) . ': enable to bind \'' . $uri . '\': scheme \'' . $scheme . '\' is not supported');
            return false;
        }
        $socket->attachTo($this);
        if ($socket->bindSocket()) {
            if ($this->enabled) {
                $socket->enable();
            }
            return true;
        }
        return false;
    }
public function bindSocket($uri)
    {
        $u = \PHPDaemon\Config\_Object::parseCfgUri($uri);
        $scheme = $u['scheme'];
        if ($scheme === 'unix') {
            $socket = new \PHPDaemon\BoundSocket\UNIX($u);
        } elseif ($scheme === 'udp') {
            $socket = new \PHPDaemon\BoundSocket\UDP($u);
            if (isset($this->config->port->value)) {
                $socket->setDefaultPort($this->config->port->value);
            }
        } elseif ($scheme === 'tcp') {
            $socket = new \PHPDaemon\BoundSocket\TCP($u);
            if (isset($this->config->port->value)) {
                $socket->setDefaultPort($this->config->port->value);
            }
        } else {
            Daemon::log(get_class($this) . ': enable to bind \'' . $uri . '\': scheme \'' . $scheme . '\' is not supported');
            return false;
        }
        $socket->attachTo($this);
        if ($socket->bindSocket()) {
            if ($this->enabled) {
                $socket->enable();
            }
            return true;
        }
        return false;
    }
public function bindSocket ( $ uri ) { $ u = \ PHPDaemon \ Config \ _Object :: parseCfgUri ( $ uri ) ; $ scheme = $ u [ 'scheme' ] ; if ( $ scheme === 'unix' ) { $ socket = new \ PHPDaemon \ BoundSocket \ UNIX ( $ u ) ; } elseif ( $ scheme === 'udp' ) { $ socket = new \ PHPDaemon \ BoundSocket \ UDP ( $ u ) ; if ( isset ( $ this -> config -> port -> value ) ) { $ socket -> setDefaultPort ( $ this -> config -> port -> value ) ; } } elseif ( $ scheme === 'tcp' ) { $ socket = new \ PHPDaemon \ BoundSocket \ TCP ( $ u ) ; if ( isset ( $ this -> config -> port -> value ) ) { $ socket -> setDefaultPort ( $ this -> config -> port -> value ) ; } } else { Daemon :: log ( get_class ( $ this ) . ': enable to bind \'' . $ uri . '\': scheme \'' . $ scheme . '\' is not supported' ) ; return false ; } $ socket -> attachTo ( $ this ) ; if ( $ socket -> bindSocket ( ) ) { if ( $ this -> enabled ) { $ socket -> enable ( ) ; } return true ; } return false ; }
Bind given socket
@param  string $uri Address to bind
@return boolean      Success
Bind given socket