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

Symbian(RSocket DownLoad)模拟HTTP下载

 2010-10-20 07:59:57 来源:WEB开发网   
核心提示:#elseiServerName.Copy(_L("10.0.0.172"));#endif}if (sPort.Length() == 0){port = 80;}else{TLex8 iLex;iLex = sPort;iLex.Val(port);if(port == 0){port = 80

#else

iServerName.Copy(_L("10.0.0.172"));

#endif

}

if (sPort.Length() == 0)

{

port = 80;

}

else

{

TLex8 iLex;

iLex = sPort;

iLex.Val(port);

if(port == 0)

{

port = 80;

}

}

//组装HTTP请求头

if (iRequest)

{

delete iRequest;

iRequest = NULL;

}

iRequest = HBufC8::NewL(1024);

iRequest->Des().AppendFormat(_L8("POST %S HTTP/1.1 "),&iSecondUrl);

#ifdef _DEBUG

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

#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("Content-Length: 0 "));

iRequest->Des().Append(_L8("Cache-Control: no-cache "));

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

//dns 解析

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

iConnection));

iResolver.GetByName(iServerName, iHostAddress, iStatus);

iState = EResolving;

isRunning = true;

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

Tags:Symbian RSocket DownLoad

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