请问关于RHTTPSession真机上网的问题
我的程序是改自HTTPEXAMPLE的,但是当我的程序在真机运行时,假如RHTTPSession是类里的成员变量就没有问题,假如是POST函数的成员变量就会自动退出,有没有高手可以指点一下啊 ,我的代码如下:
void CHttpEngine::Post()
{
RHTTPSession iSession;
iSession.OpenL();
RConnection connection;
RSocketServ socketServ;
User::LeaveIfError(socketServ.Connect());
User::LeaveIfError(connection.Open( socketServ ));
wbUriParser.Parse(wbxmlpost);
wbTransaction = iSession.OpenTransactionL(wbUriParser, *this,
iSession.StringPool().StringF(HTTP::EPOST, RHTTPSession::GetTable()));
// Set transaction headers
RHTTPHeaders headers = wbTransaction.Request().GetHeaderCollection();
AddHeaderLwb(headers, HTTP::EUserAgent, KUserAgent,iSession);
AddProxywbxml(iSession);
AddHeaderLwb(headers, HTTP::EAccept, KAccept,iSession);
AddHeaderLwb(headers, HTTP::EContentType,KPostwbxmlType,iSession);
MHTTPDataSupplier* dataSupplier=this;
wbTransaction.Request().SetBody(*dataSupplier);
// 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);
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.
// setup preferences
connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
connectPref.SetDirection(ECommDbConnectionDirectionOutgoing);
connectPref.SetBearerSet(ECommDbBearerGPRS);
connectPref.SetIapId(iapID);
connection.Start(connectPref);
// start a synchronous connection
RStringPool strP = iSession.StringPool();
RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ,
RHTTPSession::GetTable() ),
THTTPHdrVal (socketServ.Handle()) );
TInt connPtr = REINTERPRET_CAST(TInt, &(connection));
connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection,
RHTTPSession::GetTable() ),
THTTPHdrVal (connPtr) );
// Submit the request
wbTransaction.SubmitL();
}
[解决办法]
wbUriParser.Parse(wbxmlpost);
wbxmlpost如果含有端口号,应该怎么处理?
例如http:\\192.168.5.1:80
这个80请问你是怎么处理的?