src/Socket/AbstractSocketClient.php
protected function createSocket()
    {
        $this->receivedBytes = 0;
        $this->receivedPackets = 0;
        $this->transmittedBytes = 0;
        $this->transmittedPackets = 0;
        switch (get_class($this)) {
            case TcpClient::class:
                $type = SOCK_STREAM;
                $protocol = SOL_TCP;
                break;
            case UdpClient::class:
                $type = SOCK_DGRAM;
                $protocol = SOL_UDP;
                break;
            default:
                throw new \LogicException('Other protocols not supported.');
        }
        if (!($this->socket = socket_create($this->socketDomain, $type, $protocol))) {
            $this->errorHandler->handleError();
        } else {
            $this->errorHandler->setSocket($this->socket);
        }
        $this->connectionResource = new SocketConnectionResource($this->socket);
    }
protected function createSocket()
    {
        $this->receivedBytes = 0;
        $this->receivedPackets = 0;
        $this->transmittedBytes = 0;
        $this->transmittedPackets = 0;
        switch (get_class($this)) {
            case TcpClient::class:
                $type = SOCK_STREAM;
                $protocol = SOL_TCP;
                break;
            case UdpClient::class:
                $type = SOCK_DGRAM;
                $protocol = SOL_UDP;
                break;
            default:
                throw new \LogicException('Other protocols not supported.');
        }
        if (!($this->socket = socket_create($this->socketDomain, $type, $protocol))) {
            $this->errorHandler->handleError();
        } else {
            $this->errorHandler->setSocket($this->socket);
        }
        $this->connectionResource = new SocketConnectionResource($this->socket);
    }
Создаёт сокет.

@throws ConnectionException