Icicle\Http\Server\Server::listen PHP Method

listen() public method

See also: Icicle\Socket\Server\ServerFactory::create() Options are similar to this method with the addition of the crypto_method option.
public listen ( integer $port, string $address = self::DEFAULT_ADDRESS, array $options = [] )
$port integer
$address string
$options array
    public function listen(int $port, string $address = self::DEFAULT_ADDRESS, array $options = [])
    {
        switch ($address) {
            case '*':
                $this->start($port, '0.0.0.0', $options);
                $this->start($port, '[::]', $options);
                return;
            case 'localhost':
                $this->start($port, '127.0.0.1', $options);
                $this->start($port, '[::1]', $options);
                return;
            default:
                $this->start($port, $address, $options);
        }
    }

Usage Example

Example #1
0
 public function run(int $port, string $address = '*')
 {
     $server = new Server($this);
     $server->listen($port, $address);
     \Icicle\Loop\run();
 }
All Usage Examples Of Icicle\Http\Server\Server::listen