Symbian
Symbian OS Library

FAQ-1064 How can I set up an explicit connection for an HTTP session?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Web & WAP
Created: 06/01/2004 Modified: 06/11/2004
Number: FAQ-1064
Platform: Symbian OS v7.0, Symbian OS v7.0s, Symbian OS v8.0, Symbian OS v8.0a, Symbian OS v8.0b

Question:
How do I set the connection preferences for the IAP to ensure I use my RConnection rather than a default one?

Answer:
The code fragment below shows how this is done.

//Connect to Socket server
User::LeaveIfError(iSockServ.Connect());

//Define preferences for connection
TCommDbConnPref prefs;
prefs.SetIapId(1);
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);

//Start Connection
User::LeaveIfError(iConnection.Open(iSockServ));
User::LeaveIfError(iConnection.Start(prefs));

//Set properties for session
RStringPool strP = iSession.StringPool();
RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), THTTPHdrVal (iSockServ.Handle()) );
TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) );