Jump to content

Call to undefined method database::onConnect()


andrew89898

Recommended Posts

Hey, I am getting this error when I compile my main .php file. The error says it is in xmlservbase.php at line 266

Here is what line 266 looks like......

$this->onConnect($this->clients[$i]);

 

And the only other file which has onConnect in it is Server.php and the bit with it in looks like this:

function onConnect($client){
	//$this->handleJoinRoom($this->getFreeRoom(), $client);
}

 

Thanks for helping, I am new too php!

here is the whole function of line 266

function addClient($data = null){
	if(Client::$num >= $this->config["MAX_CLIENTS"]){
		socket_close(socket_accept($this->mainSocket));
		return -1;
	}
	for ($i = 0; $i < $this->config["MAX_CLIENTS"]; $i++) {
		if (!isset($this->clients[$i])) {
			$this->clients[$i] = new Client(socket_accept($this->mainSocket), $this, $i);
			socket_set_nonblock($this->clients[$i]->sock);
			//socket_set_option($this->clients[$i]->sock, SOL_SOCKET, SO_LINGER, 4);//Wait 4 seconds before closing a socket(After close)
			socket_set_option($this->clients[$i]->sock, SOL_SOCKET, SO_REUSEADDR, 1);//Allow address reuse
			$this->sendPolicyFile($this->clients[$i]);
			266 here.$this->onConnect($this->clients[$i]);
			return 0;
		}
	}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.