<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - How to do HTTP Connection pooling - Comments</title>
 <link>http://www.newlc.com/en/forum/how-do-http-connection-pooling</link>
 <description>Comments for &quot;How to do HTTP Connection pooling&quot;</description>
 <language>en</language>
<item>
 <title>Re: How to do HTTP Connection pooling</title>
 <link>http://www.newlc.com/en/forum/how-do-http-connection-pooling#comment-41333</link>
 <description>&lt;p&gt;singhgupi.&lt;/p&gt;

&lt;p&gt;Thanks for the suggestion. I will do like wise and see.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br /&gt;
Sharath&lt;/p&gt;</description>
 <pubDate>Mon, 10 Sep 2007 08:08:33 +0200</pubDate>
 <dc:creator>sharathk</dc:creator>
 <guid isPermaLink="false">comment 41333 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: How to do HTTP Connection pooling</title>
 <link>http://www.newlc.com/en/forum/how-do-http-connection-pooling#comment-41262</link>
 <description>&lt;p&gt;This is very much possible. What I understand is that you want to use same instance of your HttpEngine from all the classes for seperate downloads.&lt;br /&gt;
Did you see the S60 Example of Http Engine. In the example, a RConnection is created in each IssueHTTPGetL or IssueHTTPPostL. I would suggest to have only one RConnection in your engine, Open n Start that in ConstructL, like&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User::LeaveIfError(iSocketServ.Connect()); //iSocketServ is RSocketServ&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User::LeaveIfError(iConnection.Open(iSocketServ));//iConnection is RConnection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User::LeaveIfError(iConnection.Start());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
and IssueHTTPGetL use the same connection,&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;TInt CHttpEngine::IssueHTTPGetL( const TDesC8&amp;amp; aUri, TInt aUniqueId,TBool aStartWaitDialog /*=EFalse*/)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Parse string to URI (as defined in RFC2396)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TUriParser8 uri;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uri.Parse( aUri );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get request method string for HTTP GET&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RStringF method = iSession.StringPool().StringF( HTTP::EGET,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RHTTPSession::GetTable());&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set them for use with open http session represented by iSession&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RStringPool strP = iSession.StringPool();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TInt connPtr = REINTERPRET_CAST(TInt, &amp;amp;(iConnection));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connInfo.SetPropertyL ( strP.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ), THTTPHdrVal (connPtr) );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Open transaction with previous method and parsed uri. This class will&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // receive transaction events in MHFRunL and MHFRunError.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iTransaction = iSession.OpenTransactionL( uri, *this, method );&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set headers for request; user agent and accepted content type&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetHeaderL( hdr, HTTP::EAccept, KAccept );&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetHeaderL(hdr, HTTP::EHost,uri.Extract(EUriHost));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Put this info in the Array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddTransactionToArray(iTransaction.Id(),aUniqueId);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Submit the transaction. After this the framework will give transaction&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // events via MHFRunL and MHFRunError.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iTransaction.SubmitL();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iRunning = ETrue;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return iTransaction.Id();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;You can see in above code I have used&lt;br /&gt;
	//Put this info in the Array&lt;br /&gt;
	AddTransactionToArray(iTransaction.Id());&lt;/p&gt;

&lt;p&gt;What I&#039;m doing is adding the transactionId in an Array, so that when I get MHFRunL, I can figure out that the callback is for particular Id. So you can respond in a way you want.&lt;br /&gt;
In brief, with above code, your different classes can make multiple IssueHTTPGetL or IssueHTTPPostL, and HttpEngine will take care of all the downloads.&lt;/p&gt;

&lt;p&gt;If you don&#039;t want to use HttpEngine, you can also use DownloadManager(S60 3rd ed onwards). You can find a lot of documentation on that.&lt;/p&gt;

&lt;p&gt;Br&lt;br /&gt;
G;p&lt;br /&gt;
&lt;a href=&quot;http://www.mobisy.com&quot;&gt;www.mobisy.com&lt;/a&gt;&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Wed, 05 Sep 2007 11:12:19 +0200</pubDate>
 <dc:creator>singhgupi</dc:creator>
 <guid isPermaLink="false">comment 41262 at http://www.newlc.com</guid>
</item>
<item>
 <title>How to do HTTP Connection pooling</title>
 <link>http://www.newlc.com/en/forum/how-do-http-connection-pooling</link>
 <description>&lt;p&gt;My application needs to do HTTP transactions from multiple classes. Is it efficient to do RSocketServer &#039;connect&#039; and RConnection - &#039;open&#039; and &#039;start&#039; separately for each request ? Can i do some kind of Connection Pooling where i reuse the RConnection and the RSocketServ objects.&lt;/p&gt;

&lt;p&gt;The API Reference says this Regarding RConnection&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/en/forum/how-do-http-connection-pooling&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/en/forum/how-do-http-connection-pooling#comments</comments>
 <category domain="http://www.newlc.com/en/forums/symbian-c">Symbian C++</category>
 <pubDate>Tue, 04 Sep 2007 05:44:17 +0200</pubDate>
 <dc:creator>sharathk</dc:creator>
 <guid isPermaLink="false">18851 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
