iap problem
| Sat, 2006-06-10 11:49 | |
|
my code is: if i use alertwin after ** iTransaction.SubmitL();
nd i wait for few second the application get the text from the server but ,if i pressed the button when alertwin show the we get app closed panic. pls solve why. RConnection iConnection; RSocketServ iSocketServ; iSocketServ.Connect(); iConnection.Open(iSocketServ,KConnectionTypeDefault); // open the IAP communications database CCommsDatabase* commDB = CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(commDB); // initialize a view CCommsDbConnectionPrefTableView* commDBView = commDB->OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionOutgoing); // go to the first record User::LeaveIfError(commDBView->GotoFirstRecord()); // Declare a prefTableView Object. CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref; // read the connection preferences commDBView->ReadConnectionPreferenceL(pref); TUint32 iapID = pref.iBearer.iIapId; // pop and destroy the IAP View CleanupStack::PopAndDestroy(commDBView); // pop and destroy the database object CleanupStack::PopAndDestroy(commDB); // Now we have the iap Id. Use it to connect for the connection. // Create a connection preference variable. TCommDbConnPref connectPref; // setup preferences connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); //connectPref.SetDirection(ECommDbConnectionDirectionOutgoing); // connectPref.SetBearerSet(ECommDbBearerGPRS); // connectPref.SetIapId(iapID); // start a synchronous connection CEikonEnv::Static()->AlertWin(_L("123")); TInt errConnect = iConnection.Start(connectPref); CEikonEnv::Static()->AlertWin(_L("456 ")); // associate the current socket server session and rconnection object RStringPool strP = iSession.StringPool(); RHTTPConnectionInfo connInfo = iSession.ConnectionInfo(); connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) ); TInt connPtr = REINTERPRET_CAST(TInt, &(iConnection)); connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) ); /* CApaCommandLine* cmdLine=CApaCommandLine::NewLC(); cmdLine->SetCommandL(EApaCommandOpen); cmdLine->SetLibraryNameL(KOperaBrowser); TBuf<256> url; url.Copy(_L("http://www.dodo.com/a.txt")); cmdLine->SetDocumentNameL(url); RApaLsSession session; session.Connect(); session.StartApp(*cmdLine); CleanupStack::PopAndDestroy(cmdLine); // cmdLine*/ // Parse string to URI (as defined in RFC2396) TUriParser8 uri; uri.Parse(aUri); // Get request method string for HTTP GET RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable()); // CEikonEnv::Static()->AlertWin(_L("789 ")); // Open transaction with previous method and parsed uri. This class will // receive transaction events in MHFRunL and MHFRunError. iTransaction = iSession.OpenTransactionL(uri, *this, method); // Set headers for request; user agent and accepted content type RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent); SetHeaderL(hdr, HTTP::EAccept, KAccept); // CEikonEnv::Static()->AlertWin(_L("988 ")); // Submit the transaction. After this the framework will give transaction // events via MHFRunL and MHFRunError. CEikonEnv::Static()->AlertWin(_L("222 ")); iTransaction.SubmitL(); CEikonEnv::Static()->AlertWin(_L("777 ")); iRunning = ETrue; _LIT(KConnecting,"Connecting..."); iConnection.Close(); iSocketServ.Close(); // CleanupStack::PopAndDestroy(1); |
|






Forum posts: 2006
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant