| ID | TSS000200 | Creation date | April 7, 2005 |
| Platform | S60 2nd Edition | Devices | |
| Category | Symbian C++ | Subcategory | Networking, HTTP |
| Keywords (APIs, classes, methods, functions): |
Handling the leave when opening an HTTP session
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)
<nowiki>{</nowiki>
// 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()-<nowiki>></nowiki>InfoWinL(KErrMsg, KExitingApp);
User::Leave(err);
<nowiki>}</nowiki>
No related wiki articles found