src/MysqlProxy.php
public function connect(string $host, int $port, float $timeout = 0.1, int $tryStep = 0)
    {
        $this->timeout = $timeout;
        if (!$this->client->connect($host, $port, $timeout)) {
            if ($tryStep < 3) {
                $this->client->close();
                return $this->connect($host, $port, $timeout, ++$tryStep);
            } else {
                $this->onClientError($this->client);
                return false;
            }
        } else {
            if (!$this->isDuplex) {
                $this->mysqlClient->push($this->client);
            }
            self::go(function () {
                while (true) {
                    $data = $this->recv();
                    if ($data === '') {
                        break;
                    }
                }
            });
            return $this->client;
        }
    }
public function connect(string $host, int $port, float $timeout = 0.1, int $tryStep = 0)
    {
        $this->timeout = $timeout;
        if (!$this->client->connect($host, $port, $timeout)) {
            if ($tryStep < 3) {
                $this->client->close();
                return $this->connect($host, $port, $timeout, ++$tryStep);
            } else {
                $this->onClientError($this->client);
                return false;
            }
        } else {
            if (!$this->isDuplex) {
                $this->mysqlClient->push($this->client);
            }
            self::go(function () {
                while (true) {
                    $data = $this->recv();
                    if ($data === '') {
                        break;
                    }
                }
            });
            return $this->client;
        }
    }
connect.

@param string $host
@param int $port
@param float $timeout
@param int $tryStep

@return bool|Client