symbian 使用http get post方式获取网页信息
2010-05-31 19:38:00 来源:WEB开发网核心提示:otherwise EFlase return EFalse; } // // CClientEngine::SetupConnectionL() // // The method set the internet access point and connection setups. // void CClien
otherwise EFlase return EFalse; } //
---------------------------------------------------------------------------- //
CClientEngine::SetupConnectionL() // // The method set the internet access point
and connection setups. //
----------------------------------------------------------------------------
void CClientEngine::SetupConnectionL() { if( iConnectionSetupDone ) return;
iConnectionSetupDone = ETrue; //open socket server and start the connection
User::LeaveIfError(iSocketServ.Connect());//打开socket连接
User::LeaveIfError(iConnection.Open(iSocketServ)); // open the IAP
communications database CCommsDatabase* commDB =
CCommsDatabase::NewL(EDatabaseTypeIAP);//打开连接数据库 CleanupStack::PushL(commDB); //
initialize a view CCommsDbConnectionPrefTableView* commDBView = commDB-
>OpenConnectionPrefTableInRankOrderLC(ECommDbConnectionDirectionUnknown); //
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(ECommDbConnectionDirectionUnknown);
connectPref.SetBearerSet(ECommDbBearerGPRS); //Sets the CommDb ID of the IAP to
use for this connection connectPref.SetIapId(iapID);
User::LeaveIfError(iConnection.Start(connectPref)); //set the sessions
connection info RStringPool strPool = iSession.StringPool(); RHTTPConnectionInfo
connInfo = iSession.ConnectionInfo(); //to use our socket server and connection
connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );
connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
RHTTPSession::GetTable() ), THTTPHdrVal (REINTERPRET_CAST(TInt,
&(iConnection))) ); } // end of file
详细的可以看symbian sdk
更多精彩
赞助商链接