tags:

views:

18

answers:

1

I am in a need of multiple Transaction. But Bada is allowing me to do only one transaction. How to increase the number of Transaction? The code which i am using is

result HttpClient::TestHttpGet(Osp::Base::String link1)

{
int r1;
result r = E_SUCCESS;
HttpTransaction* pTransaction = null;
HttpRequest* pRequest = null;
String hostAddr(link1);

 if(__pSession == null)
 {
__pSession = new HttpSession();

r = __pSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, null, hostAddr, null);

if (IsFailed(r))

 goto CATCH;

}


pTransaction = __pSession->OpenTransactionN();
r1=__pSession->GetActiveTransactionCount();
AppLog("Total no of transaction:%d",r);
if (null == pTransaction)
{
 r = GetLastResult();
 goto CATCH;
 }

r = pTransaction->AddHttpTransactionListener(*this);

if (IsFailed(r))

 goto CATCH;


 pRequest = const_cast<HttpRequest*>(pTransaction->GetRequest());

if(pRequest == null)
{
r = GetLastResult();

 goto CATCH;

}

r = pRequest->SetUri(link1);

if(IsFailed(r))

goto CATCH;

r = pRequest->SetMethod(NET_HTTP_METHOD_GET);

if(IsFailed(r))

 goto CATCH;

r = pTransaction->Submit();

if(IsFailed(r))

 goto CATCH;

return r;

CATCH:

 return r;
 }
A: 

You can have up to six simultaneous Session (HttpSession). Each session can start several transactions (HttpTransaction) but only sequentially.

My advice: use several sessions if you need to connect to different hosts. But for each host, use only one transaction at a time. You won't go faster if you try to make several connection to the same host (remember you are on a phone with limited network bandwith which has to be shared between parallel connections).

Rémy DAVID
Thank You Remy David.. I got another solution tat is creating an array of session and after finishing of each transaction the array value will be incremented. So each time new transaction will created.
arulraj