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

Symbian(RSocket DownLoad)模拟HTTP下载

 2010-10-20 07:59:57 来源:WEB开发网   
核心提示:"),&_L8("10.0.0.172"));#elseif(isWap){iRequest->Des().AppendFormat(_L8("Host:%S"),&_L8("10.0.0.172"));}else{iRequest->D
"),&_L8("10.0.0.172"));

#else

if(isWap)

{

iRequest->Des().AppendFormat(_L8("Host:%S "),&_L8("10.0.0.172"));

}

else

{

iRequest->Des().AppendFormat(_L8("Host:%S "),&sHost);

}

#endif

iRequest->Des().AppendFormat(_L8("X-Online-Host:%S "),&sHost);

iRequest->Des().Append(_L8("User-Agent: myhttpClient 1.0 "));

//在请求头里设置断点续传

iRequest->Des().Append(_L8("Accept: */* Range: bytes="));

iRequest->Des().AppendNum(size);

iRequest->Des().Append(_L8("-"));

iRequest->Des().AppendNum(size+MAXDOWNLOADSIZE);

iRequest->Des().Append(_L8(" "));

iRequest->Des().Append(_L8("Connection: Close "));

//dns 解析

User::LeaveIfError(iResolver.Open(iSockServer, KAfInet, KProtocolInetTcp,

iConnection));

iResolver.GetByName(iServerName, iHostAddress, iStatus);

iState = EResolving;

isRunning = true;

SetActive();

}

//POST 请求

void CWebClientEngine::StartPostClient(const TDesC8& aURL,int size)

{

Cancel();

iSocket.Close();

iResolver.Close();

iSecondUrl.Copy(aURL);

iDownloadSize = size;

curSizeL = size+MAXDOWNLOADSIZE;

TUriParser8 m_oUri;

m_oUri.Parse(iSecondUrl);

const TDesC8& sScheme=m_oUri.Extract(EUriScheme);

const TDesC8& sHost=m_oUri.Extract(EUriHost);

const TDesC8& sPort=m_oUri.Extract(EUriPort);

const TDesC8& sPath=m_oUri.Extract(EUriPath);

if (!isWap)

{

iServerName.Copy(sHost);

}

else//WAP接入点,设置代理

{

#ifdef _DEBUG

iServerName.Copy(sHost);

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

Tags:Symbian RSocket DownLoad

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