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.

Archived:Handling the Symbian Leave when opening an HTTP session

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Compatibility
Platform(s): S60 2nd Edition
S60 2nd Edition (initial release)
Article
Created: User:Technical writer 1 (07 Apr 2005)
Last edited: hamishwillee (14 Jun 2012)

Overview

Handling the leave when opening an HTTP session

Description

RHTTPSession::OpenL leaves with KErrNotFound if the Internet AP is not correctly configured - this is probably the first problem anyone encounters when using the HTTP API on a device because OpenL works with most SDKs on the emulator with default AP configuration.

The solution is to TRAP the leave and instruct the user to configure the Internet AP.

// Open RHTTPSession with default protocol ("HTTP/TCP")
TRAPD(err, iSession.OpenL());
if(err != KErrNone)
&nbsp;&nbsp;&nbsp;&nbsp; <nowiki>{</nowiki>
&nbsp;&nbsp;&nbsp; // Most common error; no access point configured, and
&nbsp;&nbsp;&nbsp; // session creation leaves with KErrNotFound.
&nbsp;&nbsp;&nbsp; _LIT(KErrMsg, "Cannot create session. Is internet access point configured?");
&nbsp;&nbsp;&nbsp; _LIT(KExitingApp, "Exiting app.");
&nbsp;&nbsp;&nbsp; CEikonEnv::Static()-<nowiki>></nowiki>InfoWinL(KErrMsg, KExitingApp);
&nbsp;&nbsp;&nbsp; User::Leave(err);
&nbsp;&nbsp;&nbsp; <nowiki>}</nowiki>
This page was last modified on 14 June 2012, at 05:49.
27 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.

×