Jump to content

Socket Errors


andrew89898

Recommended Posts

Hi, I am getting a couple of errors when running a third party php script

 

PHP Error: 8: Undefined property: ***********::$xmltypehandlers, in *************

←[32m

[xmlServ:0] ←[33;1m[10:31:15]←[1m ←[37mStarted CPSM, version 0.04, Login Se
rver communication mode: database
←[00m
Connected to MySQL server localhost username ***
PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in*******\ClientBase.php at 33!
PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in ******\ClientBase.php at 43!
←[32m[xmlServ:1] ←[33;1m[10:31:46]←[1m ←[37mClient created, ID:1, Socket ID: 0,
rndK: ?NeR9X3lTWw←[00m
PHP Error: 8: Use of undefined constant MSG_EOR - assumed 'MSG_EOR', in *********\ClientBase.php at 33!
PHP Error: 2: socket_send() expects parameter 4 to be long, string given, in *********\ClientBase.php at 43!
←[32m[xmlServ:1] ←[33;1m[10:31:46] ←[35;1mMalformed packet <policy-file-request/
>  sent by 0←[00m

Since most of the errors originate in ClientBase.php Here is that File:
<?php
class ClientBase{
static $num = 0;
static $count = 0;
public $properties = array();
public $p = null;
public $sock;
public $parent;
public $room;
public $uniqueid = 0;
public $inGame = false;
public $xpos = 0;
public $ypos = 0;
public $clientID = 0;
public $name = "";

function __construct($sock, $server, $clientid){
	self::$num++;
	self::$count++;
	$this->parent =& $server;
	$this->uniqueid = self::$count;
	$this->sock = $sock;
	$this->p =& $this->properties;//p and properties are for temporary properties.
	$this->p['rndK'] = $this->makeRndK();
	$this->clientID = $clientid;
}

/*function __destruct(){
	self::$num--;
	@socket_close($this->sock);
}*/

function write($data, $flags = MSG_EOR){
	$data .= chr(0);
	$sendLen = strlen($data);
	$w = array($this->sock);
	$a = null;
	$b = null;
	$res = @socket_select($a, $w, $b, 0.15);
	if($res === false){
		return $this->parent->removeClient($this->clientid);
	}
	$len = @socket_send($this->sock, $data, $sendLen, $flags);
	//$times = 5;
	/*while($len === false && $len < $sendLen){
		if($len === false){
			$ltr = 0;
		}
		else
			$ltr = $len;
		$data = substr($data, $ltr);
		$sendLen = strlen($data);
		$len = @socket_send($this->sock, $data, $sendLen, $flags);
		usleep(2000);
		$times--;
		if($times < 0)
			break;
	}*/
	return $len ? true : false;
}

function makeRndK(){
	$c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxwz0123456789?~";
	$l = rand(6,14);
	$s = "";
	for(;$l > 0;$l--)
		$s .= $c{rand(0,strlen($c) - 1)};
	return $s;
}

function buildClientString($type = "raw", $s = "%"){
	if($type == "xml"){
		return $this->buildXmlPlayer();
	}
	return $this->buildRawPlayer($s);
}

function getSortedProperties(){

}

function buildRawPlayer($s){
	return implode($this->getSortedProperties(), $s);
}

function getSocket(){
	return $this->sock;
}
}
?>

 

Please Help, Thanks. If the first error means a lot I will post some of that file too.

Link to comment
https://forums.phpfreaks.com/topic/231831-socket-errors/
Share on other sites

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.