Exemplo n.º 1
0
 /**
  * Connects the AbstractTransport object and performs initial actions on the remote
  * server.
  *
  * @throws Ts3Exception
  * @return void
  */
 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(StringHelper::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);
 }