Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

处理打开HTTP会话时发生的异常

From Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 29 Jun 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 开发伙伴平台:

60系列开发平台 2.0


  • 详细描述

如果Internet AP没有正确配置的话,则RHTTPSession::OpenL()会引发KErrNotFound错误。这可能是每个开发者在设备上运行该类使用HTTP AP所会遇到的一个问题。因为在模拟器上,OpenL()方法会使用默认的AP连接点配置。


解决的方法就是捕捉到错误并通知用户配置正确的Internet AP。

// Open RHTTPSession with default protocol ("HTTP/TCP")
TRAPD(err, iSession.OpenL());
if(err != KErrNone)
{
// Most common error; no access point configured, and
// session creation leaves with KErrNotFound.
_LIT(KErrMsg, "Cannot create session. Is internet access point configured?");
_LIT(KExitingApp, "Exiting app.");
CEikonEnv::Static()->InfoWinL(KErrMsg, KExitingApp);
User::Leave(err);
}
This page was last modified on 15 December 2011, at 10:01.
53 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×