Example #1
0
 /**
  * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
  * server.
  *
  * @throws TeamSpeak3_Adapter_Exception
  * @return void
  */
 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);
 }
Example #2
0
 /**
  * Connects the AbstractTransport object and performs initial actions on the remote
  * server.
  *
  * @throws Ts3Exception
  * @return void
  */
 public function syn()
 {
     if (!isset($this->options["port"]) || empty($this->options["port"])) {
         $this->options["port"] = $this->default_port;
     }
     $this->initTransport($this->options);
     $this->transport->setAdapter($this);
     Profiler::init(spl_object_hash($this));
     Signal::getInstance()->emit("tsdnsConnected", $this);
 }
Example #3
0
 /**
  * Connects the TeamSpeak3_Transport_Abstract object and performs initial actions on the remote
  * server.
  *
  * @throws TeamSpeak3_Adapter_Exception
  * @return void
  */
 protected function syn()
 {
     $this->initTransport($this->options);
     $this->transport->setAdapter($this);
     \TeamSpeak3\Helper\Profiler::init(spl_object_hash($this));
     if (!$this->getTransport()->readLine()->startsWith(TeamSpeak3::READY)) {
         throw new Exception("invalid reply from the server");
     }
     \TeamSpeak3\Helper\Signal::getInstance()->emit("serverqueryConnected", $this);
 }
Example #4
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(HelperString::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);
 }
Example #5
0
 /**
  * Returns the profiler timer used for this connection adapter.
  *
  * @return TeamSpeak3_Helper_Profiler_Timer
  */
 public function getProfiler()
 {
     return \TeamSpeak3\Helper\Profiler::get(spl_object_hash($this));
 }
 /**
  * Returns the profiler timer used for this connection adapter.
  *
  * @return Timer
  */
 public function getProfiler()
 {
     return Profiler::get(spl_object_hash($this));
 }
Example #7
0
 /**
  * Checks for required PHP features, enables autoloading and starts a default profiler.
  *
  * @throws LogicException
  * @return void
  */
 public static function init()
 {
     if (version_compare(phpversion(), "5.2.1") == -1) {
         throw new LogicException("this particular software cannot be used with the installed version of PHP");
     }
     if (!function_exists("stream_socket_client")) {
         throw new LogicException("network functions are not available in this PHP installation");
     }
     if (!function_exists("spl_autoload_register")) {
         throw new LogicException("autoload functions are not available in this PHP installation");
     }
     if (!class_exists("\\TeamSpeak3\\Helper\\Profiler")) {
         spl_autoload_register(array(__CLASS__, "autoload"));
     }
     \TeamSpeak3\Helper\Profiler::start();
 }