All pastes #916560 Raw Edit

Anonymous

public cpp v1 · immutable
#916560 ·published 2008-02-24 19:28 UTC
rendered paste body
// Upload the next chunk to the server.void WiredTransferSocket::sendNextFileChunk(qint64 theOffset) {	const int tmpChunkSize = 4096 * 8; // 4096 is the page size on x86 - a good value for buffer sizes		if( pSendingFile && pTransfer.pTransferType==1 ) {				qDebug() << "Sending"<<theOffset<<"bytes";		if(!pFile->atEnd()) { // Done!			pFile->seek(pTransfer.pOffset);			qDebug() << "Sending"<<tmpChunkSize<<"bytes at pos"<<pFile->pos();			QByteArray tmpData = pFile->read(tmpChunkSize);			pTransfer.pOffset += pSocket->write(tmpData);			if(pTransfer.pOffset == FILESIZE) {				qDebug() << "We are done. Close.";				pSocket->disconnectFromHost();			}		}	}}