Jump to content

Call to undefined method database::onConnect()


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......



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!

Link to comment
Share on other sites

here is the whole function of line 266

function addClient($data = null){
	if(Client::$num >= $this->config["MAX_CLIENTS"]){
		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_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
			266 here.$this->onConnect($this->clients[$i]);
			return 0;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.