setSettings("recv_timeout", 1000); } public function loop() { if(!$client->connected()) { $host = $this->getSetting("host"); $port = $this->getSetting("port"); if($host == null || $port == null) { Throw new Exception("Uplink Settings missing."); return; } $state = $client->connect($host, $port, $this->getSettings("bind"), $this->getSettings("ssl"), $this->getSettings("recv_timeout")); if(!$state) { usleep($this->getSetting("recv_timeout") / 1000); return; } } //try to receive new data from the Uplink //null } public function setUplink($host, $port, $ssl = false, $bind = null) { $this->setSetting("host", $host); $this->setSetting("port", $port); $this->setSetting("ssl", $ssl); $this->setSetting("bind", $bind); } public function setLoopTimeout($timeout) { $this->setSetting("recv_timeout", $timeout); } public function setUplinkServer($numeric, $name, $password) { $this->setSetting("numeric", Numerics::intToNum($numeric, 2)); $this->setSetting("name", $name); $this->setSetting("password", $password); } private function setSetting($setting, $value) { $this->settings[$setting] = $value; } private function getSetting($setting) { if(array_key_exists($setting, $this->settings)) { return $this->settings[$setting]; } else { return null; } } } ?>