//3 - Log / Save IP / Ban IP, whatever will do. //4 - and terminate thread. echo 'Error: LENGTH REFUSED!' . "\n"; } //Okay now the interesting part //is the [buffer data] (full size - packet header) //greater OR equal the [capsule data] length we have been told earlier? if ($BUFFER->size() - 5 >= $length) { if ($VERBOSE) { echo 'Enough bytes, processing...' . "\n"; } //Awesome we have enough bytes now :D //Lets continue the "so waited" code part //Copy the 5+length first bytes from the buffer to $CAPSULE. $CAPSULE = new ByteArray(); $CAPSULE->append(substr($BUFFER->getBuffer(), 5, $length)); //position to 5 and read length bytes //PROCESS THE CAPSULE (switch and stuff) //----------------------------------------------- if ($VERBOSE) { echo 'Capsule: ' . $CAPSULE->getBuffer() . "\n"; } while (true) { //a loop to parse all CMDs in the capsule switch ($CAPSULE->readWord()) { //------------------------- case PCKT_R_WORLD_EOF: echo '[capsuleHandler] End of world server list' . "\n"; break; //------------------------- //-------------------------