WEB开发网
开发学院手机开发Symbian 开发 Symbian (Http DownLoad) Http 引擎下载实现 阅读

Symbian (Http DownLoad) Http 引擎下载实现

 2010-02-08 03:06:00 来源:WEB开发网   
核心提示:if(err == false){body->ReleaseData();CancelTransactionL();//重新请求分二种情况//GET请求,POST请求if (bHttpGetOrPost)//get方法{iDownloadSize = 0;StartGetClient(iSecondUrl,iDo

if(err == false)

{

body->ReleaseData();

CancelTransactionL();

//重新请求分二种情况

//GET请求,POST请求

if (bHttpGetOrPost)//get方法

{

iDownloadSize = 0;

StartGetClient(iSecondUrl,iDownloadSize);

}

else

{

HTTPPostL(iSecondUrl,*DataSecondPost);

}

break;

}

}

iObserver->HandleWebData(dataChunk);

body->ReleaseData();

iDownloadSize += DataLength;

StartTimer(30);//30s超时

RLog::LogPoor(_L("Exit EGotResponseBodyData"));

}

break;

case THTTPEvent::EResponseComplete:

{

//响应服务器完成

RLog::LogPoor(_L("EResponseComplete"));

}

break;

case THTTPEvent::ESucceeded:

{

//整个事物成功处理

RLog::LogPoor(_L("ESucceeded"));

RLog::LogPoor(_L("iDownloadSize = "),iDownloadSize);

if(iDownloadSize < iFileLength - 1)

{

aTransaction.Close();

StartGetClient(iSecondUrl,iDownloadSize);

break;

}

// Transaction can be closed now. It's not needed anymore.

aTransaction.Close();

StopTimer();

iObserver->HandleWebDataCompleteL();

bIsReciveData = ETrue;

iRunning = EFalse;

}

break;

case THTTPEvent::EFailed:

{

//异常出现

RLog::LogPoor(_L("EFailed"));

aTransaction.Close();

StopTimer();

iObserver->HandleError();

iRunning = EFalse;

iDownloadSize = 0;

}

break;

default:

{

TInt err = aEvent.iStatus;

RLog::LogPoor(_L("err = "),err);

if (aEvent.iStatus < 0)

{

aTransaction.Close();

StopTimer();

iObserver->HandleError();

iRunning = EFalse;

}

}

break;

}

}

经过上述处理就可以完成整个下载流程了.

以上代码适合SYMBIAN 2nd,3rd,5th三个平台通用.

上一页  1 2 3 4 5 

Tags:Symbian Http DownLoad

编辑录入:coldstar [复制链接] [打 印]
赞助商链接