function _connect($server_id) { $this->log($server_id, 3, "connecting to " . $this->servers[$server_id]['options']['server'] . ":" . $this->servers[$server_id]['options']['port'] ); $this->servers[$server_id]['socket'] = fsockopen($this->servers[$server_id]['options']['server'], $this->servers[$server_id]['options']['port'], $errno, $errstr, 5); if (!$this->servers[$server_id]['socket']) { $this->log($server_id,0, "could not connect $errstr ($errno)"); return false; } $this->log($server_id, 3, "connected"); $this->init_stats($server_id); $this->command($server_id, 'USER '. $this->servers[$server_id]['options']['identd'] . ' '. $this->servers[$server_id]['options']['host'] . ' '. $this->servers[$server_id]['options']['server'] . ' '. ':' . $this->servers[$server_id]['options']['realname']); $this->command($server_id, 'NICK ' . $this->servers[$server_id]['options']['nick']); socket_set_blocking($this->servers[$server_id]['socket'], false); $this->callback($server_id,'CONNECT', false); $this->stats[$server_id]['events']['PING']['last'] = $this->get_microtime(); return $server_id; }