Tuesday, January 12, 2016

Will RHTTPSession questions about the real machine Internet




            


My program is adapted from HTTPEXAMPLE, but when my real machine when the program is run, if RHTTPSession class member variable is no problem, if it is a member variable POST function will automatically exit, there is no master can give pointers about ah, my code is as follows:
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- & gt; OpenConnectionPrefTableInRankOrderLC (ECommDbConnectionDirectionOutgoing);

// Go to the first record
User :: LeaveIfError (commDBView- & gt; GotoFirstRecord ());

// Declare a prefTableView Object.
CCommsDbConnectionPrefTableView :: TCommDbIapConnectionPref pref;

// Read the connection preferences
commDBView- & gt; 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, & amp; (connection));
connInfo.SetPropertyL (strP.StringF (HTTP :: EHttpSocketConnection,
RHTTPSession :: GetTable ()),
THTTPHdrVal (connPtr));
// Submit the request
wbTransaction.SubmitL ();
}
Reply:
wbUriParser.Parse (wbxmlpost);
wbxmlpost if it contains a port number, it should be how to deal with?
For example http: \\ 192.168.5.1:80
This is how 80 Will you handle it?

No comments:

Post a Comment