protected function init() { // 运行2个服务实例分别监听不同的端口 @todo 也可以在daemon中运行多个实例 $this->debugServer = new debugWS('0.0.0.0', 8888); // $this->debugServer->bindSocket(); $this->bindSocket(Config::get('host'), Config::get('port')); }
public function bindSocket($addr = null, $port = null) { if ($addr === null && $port === null) { $addr = Config::get('host'); $port = Config::get('port'); } parent::bindSocket($addr, $port); }
public static function getPdo() { $user = Config::getField('mysql', 'user'); $pwd = Config::getField('mysql', 'pwd'); $host = Config::getField('mysql', 'host'); $db = Config::getField('mysql', 'db'); $port = Config::getField('mysql', 'port'); $pdoConfg = array('dsn' => "mysql:host={$host};port={$port}", 'user' => $user, 'pass' => $pwd, 'dbname' => $db); return Factory::getInstance("ANSIO\\Pdo", $pdoConfg); }