clientRequest* IllbdrClient::GetCompletedRequest(){ // First off, do we even have a completed chunk? if( !IsCompleteChunkAvailable() ) return NULL; // We do! Then lets get the data out of that buffer clientHeader ch = BufferSocket::ReadVar<clientHeader>(); LPVOID rawData = malloc( ch.chunkSize + sizeof( DWORD ) ); BufferSocket::Read( rawData, ch.chunkSize ); // OK, now that we have that data, we must remove all // decompression and encryption applied if( ch.command & netflagCompressed ) // Compression was applied { ch.chunkSize ^= netflagCompressed; } if( ch.command & netflagEncrypted ) // Encryption was applied { ch.command ^= netflagEncrypted; } // Ok, create our struct and return it clientRequest* cRet = new clientRequest; cRet->cCmd = ch.command; cRet->cData = rawData;}