Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
server.

@throws TeamSpeak3_Adapter_Update_Exception
@return void
1156
public function syn()
  {
    if(!isset($this->options["host"]) || empty($this->options["host"])) $this->options["host"] = $this->default_host;
    if(!isset($this->options["port"]) || empty($this->options["port"])) $this->options["port"] = $this->default_port;

    $this->initTransport($this->options, "TeamSpeak3_Transport_UDP");
    $this->transport->setAdapter($this);

    TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));

    $this->getTransport()->send(TeamSpeak3_Helper_String::fromHex(33));

    if(!preg_match_all("/,?(\d+)#([0-9a-zA-Z\._-]+),?/", $this->getTransport()->read(96), $matches) || !isset($matches[1]) || !isset($matches[2]))
    {
      throw new TeamSpeak3_Adapter_Update_Exception("invalid reply from the server");
    }

    $this->build_datetimes = $matches[1];
    $this->version_strings = $matches[2];

    TeamSpeak3_Helper_Signal::getInstance()->emit("updateConnected", $this);
  }
567708
private function connect():void
    {

        socket_connect($this->socket, $this->host, $this->port) or $this->error();

    }
837226
public function connect()
    {
        list($host, $port) = explode(':', $this->getServer());
        if ($this->stream->open($host, $port, $this->getTimeout()) === false) {
            throw new Exception(sprintf('Cannot connect to server %s', $this->getServer()), Exception::SERVER_OFFLINE);
        }

        return true;
    }
1017467
public function connect()
    {

          //if port is not set, try and determine based on transport
        if(!is_numeric($this->port)){
            if(substr($this->host, 0, 3) == 'ssl'){
                $this->port = 5223;
                $this->log("Connecting with SSL");

            } else {
                $this->port = 5222;
            }
        }

        parent::__construct($this->host.':'.$this->port, $this->timeout);

        $this->open();

        //begin stream
        $this->write("<stream:stream to='$this->host' xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' version='1.0'>");

        $this->read();
        $this->read();

        $this->connected = true;

    }
1092629
public function open()
    {
        // Connect the socket.
        if (@!socket_connect($this->socket, $this->host, $this->port)) {
         Logger::get()->error(socket_strerror(socket_last_error()));
            throw new Exception('Socket connection error: ' . socket_strerror(socket_last_error()));
        }
    }
1046410
public function connect()
    {
        ['hostname' => $host, 'port' => $port, 'timeout' => $timeout] = $this->config;

        if ($this->config['tls']) {
            $this->connection = ftp_ssl_connect($host, $port, $timeout);
        } else {
            $this->connection = ftp_connect($host, $port, $timeout);
        }

        if (!$this->connection) {
            throw new RuntimeException(sprintf('Could not connect to %s:%s', $host, $port));
        }

        $this->login();
        $this->setConnectionRoot();
        $this->setConnectionPassiveMode();
    }
361685
protected function connect()
    {
        $errstr = '';
        $errno  = 0;

        $this->log('creating socket ... ', Net_Notifier_Logger::VERBOSITY_ALL);

        try {
            $this->socket = new Net_Notifier_Socket_Server(
                sprintf(
                    'tcp://0.0.0.0:%s',
                    $this->port
                ),
                null
            );
        } catch (Net_Notifier_Socket_Exception $e) {
            $this->log(
                'failed' . PHP_EOL,
                Net_Notifier_Logger::VERBOSITY_ALL,
                false
            );
            throw $e;
        }

        $this->log('done' . PHP_EOL, Net_Notifier_Logger::VERBOSITY_ALL, false);

        $this->connected = true;
    }
648118
private function connect()
    {
        if (!$this->_sock) {
            if ($this->_persistentSocket) {
                $this->_sock = pfsockopen($this->_host, $this->_port, $errno, $errstr, $this->_connectTimeout/1000);
            } else {
                $this->_sock = fsockopen($this->_host, $this->_port, $errno, $errstr, $this->_connectTimeout/1000);
            }

            if (!$this->_sock) {
                throw new \Exception('Unable to connect to FastCGI application: ' . $errstr);
            }

            if (!$this->set_ms_timeout($this->_readWriteTimeout)) {
                throw new \Exception('Unable to set timeout on socket');
            }
        }
    }
1246503
private function connect()
    {
        if (!$this->isConnected) {
            parent::__construct(
                $this->dsn,
                $this->server->getUsername(),
                $this->server->getPassword(),
                $this->driverOptions
            );
            parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            parent::setAttribute(
                PDO::ATTR_STATEMENT_CLASS,
                [__NAMESPACE__ . '\\' . self::PDO_STATEMENT_CLASS, [$this]]
            );

            $this->isConnected = true;
        }
    }
438251
public function connect()
    {
        $socket = $this->createSocket(
            $this->connection->getHostname(),
            $this->connection->getPort(),
            $this->throttle
        );

        $this->setSocket($socket);
    }
849479
protected function _connect()
    {
        if (!is_null($this->_connection)) {
            return;
        }

        try {
            $this->_connection = new Horde_Imap_Client_Socket_Connection_Pop3(
                $this->getParam('hostspec'),
                $this->getParam('port'),
                $this->getParam('timeout'),
                $this->getParam('secure'),
                $this->getParam('context'),
                array(
                    'debug' => $this->_debug
                )
            );
        } catch (Horde\Socket\Client\Exception $e) {
            $e2 = new Horde_Imap_Client_Exception(
                Horde_Imap_Client_Translation::r("Error connecting to mail server."),
                Horde_Imap_Client_Exception::SERVER_CONNECT
            );
            $e2->details = $e->details;
            throw $e2;
        }

        $line = $this->_getResponse();

        // Check for string matching APOP timestamp
        if (preg_match('/<.+@.+>/U', $line['resp'], $matches)) {
            $this->_temp['pop3timestamp'] = $matches[0];
        }
    }
1250234
protected function initTransport($options, $transport = "TeamSpeak3_Transport_TCP")
  {
    if(!is_array($options))
    {
      throw new TeamSpeak3_Adapter_Exception("transport parameters must provided in an array");
    }

    $this->transport = new $transport($options);
  }
251163
protected function connect()
    {
        $schema = ($this->_secure === 'ssl' || $this->_secure === 'tls' ? $this->_secure . '://' : '');
        $url = $schema  . $this->_host . ':' . $this->_port;
        $this->_connection = stream_socket_client($url, $errno, $error, $this->_timeout, STREAM_CLIENT_CONNECT, $this->_context);
        if (!$this->_connection) {
            throw new NetException($error, $errno);
        }
        stream_set_timeout($this->_connection, $this->_timeout, 0);
        $this->read();

        $this->write("EHLO {$this->_client}");
        $ehloResponse = $this->read();

        if ($this->_secure === 'starttls') {
            $this->write('STARTTLS', 220);
            if (!stream_socket_enable_crypto($this->_connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
                throw new NetException('Unable to connect via TLS.');
            }
            $this->write("EHLO {$this->_client}", 250);
        }

        if ($this->_username !== null && $this->_password !== null) {
            $authMechanisms = [];
            if (preg_match('~^250[ -]AUTH (.*)$~im', $ehloResponse, $matches)) {
                $authMechanisms = explode(' ', trim($matches[1]));
            }

            if (in_array('PLAIN', $authMechanisms, true)) {
                $credentials = $this->_username . "\0" . $this->_username . "\0" . $this->_password;
                $this->write('AUTH PLAIN ' . base64_encode($credentials), 235, 'PLAIN credentials');
            } else {
                $this->write('AUTH LOGIN', 334);
                $this->write(base64_encode($this->_username), 334, 'username');
                $this->write(base64_encode($this->_password), 235, 'password');
            }
        }
    }
1197711
public function syn()
  {
    $this->initTransport($this->options);
    $this->transport->setAdapter($this);

    TeamSpeak3_Helper_Profiler::init(spl_object_hash($this));

    TeamSpeak3_Helper_Signal::getInstance()->emit("filetransferConnected", $this);
  }
1358985
private function connect() {
        $connection = fsockopen('tcp://'.$this->options['host'],
                                         $this->options['port'],
                                         $errorCode,
                                         $errorMsg,
                                         $this->options['timeout']);
        // TODO: connect() might hang without producing an error if the connection fails
        if (!$connection) throw new RuntimeException('Could not open socket: '.$errorMsg.' (error '.$errorCode.')');

        $data = stream_get_meta_data($connection);
        if ($data['timed_out']) throw new InfrastructureException('Timeout on socket connection');

        socket_set_timeout($connection, $this->options['timeout']);
        $this->connection = $connection;

        // init connection
        $this->readResponse();                          // read greeting
        $this->writeData('EHLO '.$this->hostName);      // extended "Hello" first
        $response = $this->readResponse();

        $this->parseResponse($response);
        if ($this->responseStatus != 250) {
            $this->writeData('HELO '.$this->hostName);  // regular "Hello" if the extended one fails
            $response = $this->readResponse();

            $this->parseResponse($response);
            if ($this->responseStatus != 250)
                throw new RuntimeException('HELO command not accepted: '.$this->responseStatus.' '.$this->response);
        }
    }
760828
private function connect()
    {
        $this->conn = parent::getConn();
        $this->update = $this->conn->prepare($this->update);
    }
1357708
public function syn()
    {
        if (!isset($this->options["host"]) || empty($this->options["host"])) {
            $this->options["host"] = $this->default_host;
        }
        if (!isset($this->options["port"]) || empty($this->options["port"])) {
            $this->options["port"] = $this->default_port;
        }

        $this->initTransport($this->options, "UDP");
        $this->transport->setAdapter($this);

        Profiler::init(spl_object_hash($this));

        $this->getTransport()->send(String::fromHex(33));

        if (!preg_match_all(
                "/,?(\d+)#([0-9a-zA-Z\._-]+),?/",
                $this->getTransport()->read(96),
                $matches
            ) || !isset($matches[1]) || !isset($matches[2])
        ) {
            throw new Ts3Exception("invalid reply from the server");
        }

        $this->build_datetimes = $matches[1];
        $this->version_strings = $matches[2];

        Signal::getInstance()->emit("updateConnected", $this);
    }