You Are Here:

Community: Wiki

This page was last modified on 29 October 2008, at 14:51.

TSS000200 - Handling the leave when opening an HTTP session

From Forum Nokia Wiki


ID TSS000200 Creation date April 7, 2005
Platform S60 2nd Edition Devices
Category Symbian C++ Subcategory Networking, HTTP


Keywords (APIs, classes, methods, functions):

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>

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia