WEB开发网
开发学院手机开发Symbian 开发 Symbian(RSocket DownLoad)模拟HTTP下载 阅读

Symbian(RSocket DownLoad)模拟HTTP下载

 2010-10-20 07:59:57 来源:WEB开发网   
核心提示:SetActive();}//好,请求部分完了之后,让我们来看看如何响应了.哈哈!!!!void CWebClientEngine::RunL(){if (iStatus.Int() == KErrNone){switch (iState){case EResolving:{//域名解析完成后//连接HOSTUser:

SetActive();

}

//好,请求部分完了之后,让我们来看看如何响应了.哈哈!!!!

void CWebClientEngine::RunL()

{

if (iStatus.Int() == KErrNone)

{

switch (iState)

{

case EResolving:

{

//域名解析完成后

//连接HOST

User::LeaveIfError(iSocket.Open(iSockServer, KAfInet,

KSockStream,

KProtocolInetTcp, iConnection));

TInetAddr address;

address = iHostAddress().iAddr;

address.SetPort(port);

iState = EConnecting;

iSocket.Connect(address, iStatus) ;

SetActive();

}

break;

case EConnecting:

{

//连接成功后,发送请求

iSocket.Write(iRequest->Des(), iStatus) ;

iState = ESending;

SetActive();

}

break;

case ESending:

{

//请求成功后,准备接收数据

iResponseChunk.Zero() ;

iSocket.RecvOneOrMore(iResponseChunk, 0, iStatus,

iResponseChunkSizePkg) ;

iState = EReceiving;

SetActive();

}

break;

case EReceiving:

{

//接收数据

int errCode = 0;

if (CheckRecv(iResponseChunk))//判断是否为移动拦截页

{

//解析数据

if (ParseWebFileInfo(iResponseChunk, SizeL, HrdLen,

errCode))

{

if (HandleStatus(errCode))

{

return;

}

//写文件

// SizeL += iDownloadSize;

iDownloadSize+=iResponseChunk.Length()-

HrdLen;

iObserver->HandleHttpProgress(SizeL,

iDownloadSize);

iObserver->HandleWebData(iResponseChunk.Mid

(HrdLen));

}

else

{

//写文件

上一页  1 2 3 4 5 6  下一页

Tags:Symbian RSocket DownLoad

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