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

Symbian(RSocket DownLoad)模拟HTTP下载

 2010-10-20 07:59:57 来源:WEB开发网   
核心提示:iDownloadSize+=iResponseChunk.Length();iObserver->HandleHttpProgress(SizeL,iDownloadSize);iObserver->HandleWebData(iResponseChunk);}}else{//移动页进行二次请求if (S

iDownloadSize+=iResponseChunk.Length();

iObserver->HandleHttpProgress(SizeL,

iDownloadSize);

iObserver->HandleWebData(iResponseChunk);

}

}

else

{//移动页进行二次请求

if (SecLink(iSecondUrl))

return;

}

iState = EReceiveMore;

iTimer.After(iStatus, 10000);

StartTimer(30);

SetActive();

}

break;

case EReceiveMore:

if (SizeL == iDownloadSize||iDownloadSize == curSizeL+1)//判

断数据是否下载完成

{

if(iDownloadSize < SizeL)

{

if (SecLink(iSecondUrl))

return;

}

Cancel();

iState = EComplete;

iTimer.After(iStatus, 1000);

StopTimer();

SetActive();

}

else//如果没有下载完成,继续准备接收数据

{

iState = EReceiving;

iResponseChunk.Zero() ;

iSocket.RecvOneOrMore(iResponseChunk, 0, iStatus,

iResponseChunkSizePkg) ;

SetActive();

}

break;

case EComplete:

{

//下载完成

iObserver->HandleWebDataCompleteL();

}

break;

}

}

}

//最重要的部分消息响应流程介绍完了.

//让我们来看看如何解析消息头的.哈哈.

_LIT8(KHttpHdrDiv, " ");

_LIT8(KHttpHdrEnd, " ");

TBool CWebClientEngine::ParseWebFileInfo(const TDesC8& recv_buf,

TInt& file_length, TInt& jump_len, TInt& status)

{

TBuf8<64> tmp_field;

TBuf8<64> tmp_end;

TBuf8<1024> tmp_str;

int find_pos;

status = 0;

//取状态码

tmp_field.Copy(_L8("HTTP/1.1 "));

tmp_end.Copy(KHttpHdrDiv) ;

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

Tags:Symbian RSocket DownLoad

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