public function __construct($socket, $index, $address) { // set private variables $this->socket = $socket; $this->index = $index; $this->ip = $address['ip']; $this->port = $address['port']; // create challenge $this->challenge = tools::generateRandomString(10); // create session $this->session = tools::generateRandomInt(5); // send challenge to client $response = gamespy::xor_this('\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1') . '\\final\\'; tools::log('server: ' . '\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1' . '\\final\\'); socket_write($this->socket, $response); tools::log('initializing new client (' . $this->ip . ':' . $this->port . ')'); }
/** * Constructor for gpcm class - initialize all necessary variables * @param type $socket * @param type $index * @param type $address */ public function __construct($socket, $index, $address) { // set private variables $this->socket = $socket; $this->index = $index; $this->ip = $address['ip']; $this->port = $address['port']; // create challenge $this->challenge = tools::generateRandomString(10); // create session $this->session = tools::generateRandomInt(5); // tell our client about this great class $response = '\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1\\final\\'; socket_write($this->socket, $response); //log tools::log('initialized class for ' . $this->ip . ':' . $this->port); }