I am using the WAP API of the WSP protocol to download a large file (order of 90K) with Nokia 7650.
I have written a code that works for files smaller than 300 bytes, but nothing happens with larger ones (not EMoreData, nothing. I have checked, I have these error messages if I want with my file smaller than 300 bytes).
I use my own gateway, and I have set the packet size to 1000 bytes. With the WAP browser given with the phone, I can download my file, and each packet is of size 1000 bytes (body).
Does someone have an idea of why I could have such a limit?
Thank you,
Nicolas
Thats the code I use, please note that I do not know what to put as headers or body and so I have left them empty.
iRemoteHost.Append(KMyHost); // IP address of the WAP server
iRemotePort = 9201; // port that connects to the gateway
/*Creation of the WAP session (on the mobile) iWSPConnection to
the WAP server iWAPSession (client side of the wap server on the mobile)
at the address iRemoteHost
on the port iRemotePort
through any local port
using te IP bearer (contrary to a SMS bearer)
without using a secure connection (protocol WTLS)*/
err = iWSPConnection.Open(iWAPSession, iRemoteHost ,iRemotePort ,0 ,EIP ,EFalse);
if ( err == KErrNone){
// we define the capabilities of the connection that is going to be used
CCapCodec * Cap = CCapCodec::NewL();
Cap->Reset(); // initialised to the default values
Cap->SetClientSDUSize(90000); // 90 000 bytes => have to use SAR
Cap->SetServerSDUSize(90000); // 90 000 bytes => have to use SAR
// connect to the server using these capabilities
err = iWSPConnection.Connect(ClientHeaders, Cap);
if ( err == KErrNone){
RWAPConn::TMethod Method = RWAPConn::EGet; // we will invoke a GET method
/* We create a transaction through the session iWSPConnection
that will be a GET Method
of the file defined by URI
as it’s a GET method, no body is required
nor any headers
and we are returned the id of this transaction iWSPTrans at WSP level*/
err = iWSPConnection.CreateTransaction(Method, iURI, iBody, iHeaders, iWSPTrans);
if ( err == KErrNone){
err=iWSPConnection.GetEvent(aEvent,iWSPTrans); // Synchronous call –which can be set as asynchronous- to know when the transaction has been successfully created. It is mandatory for continuing the transaction
do{
err = iWSPTrans.GetData(iBuf, RWSPCOTrans::EResultBody); // The result contained in the body of the transaction is stored in the buffer
if(iBuf.Length()>0){ // we ensure that we have some data
iWFichier.WriteL(iBuf, iBuf.Length()); // and we write it to the destination file
ret= KErrNone;
}else{ret=-2;break;} // an error has occured
}while(err==RWAPConn::EMoreData ); // we repeat this process until we have obtained all the requested data