Problems to Send a file using GPRS


#1

Hi all!!, im trying to send big files…lest say 10kbytes long using GPRS and check that my CPU is recieveing it OK. But my problem its only works when i send small files like 512bytes. When i try to send larger ones it doesnt work. I use the common wip funtions wip_read and wip_write. Here is my code:

..........
case WIP_CEV_READ:
  	{
      TRACE (( 4, "[WIP_CEV_READ]:Inside WIP_CEV_READ"));
               ascii *Data_Buffer = adl_memGet(512);
               if ( NULL == Data_Buffer )
               {
            	   TRACE (( 4, "[WIP_CEV_READ]:Memory allocation failure!"));
                   break;
               }
               wm_memset( Data_Buffer, '\0', 512); //i tried to put a larger number, like 4096 sending a 1k file, but itdint work.
               /*Read the data sent by the remote party*/
               u32 Read = wip_read(canal_TCP,Data_Buffer,512);
                                                  //SIZE_BUFFER is 1024
			  if(wm_strlen(datos_a_enviar+Read)<(SIZE_BUFFER*100))					  
				  wm_strcat(datos_a_enviar,Data_Buffer);
			  else
			  	{
				  wm_sprintf(datos_a_enviar,NULL);
				  TRACE((4,"[WIP_CEV_READ]:Buffer recepcion lleno"));
			  	}
			  
			  if(*(Data_Buffer+Read)==0)
                                                              {
		                     Send_Data(datos_a_enviar); //Here i send the same file i recieved, so i can compare
				wm_sprintf(datos_a_enviar,"");
				break;
                                                            }
               adl_memRelease(Data_Buffer);
			   
			 
               SetOpts = wip_setOpts(canal_TCP,WIP_COPT_RESET_CEV_READ,1,WIP_COPT_END);
               if(SetOpts == 0)
                  TRACE (( 4, "[WIP_CEV_READ]:WIP_COPT_RESET_CEV_READ"));
               break;
  	}
...................
....................
s32 Send_Data(ascii *buffer)
{
    s32 Write;
    u32 retSetOpts;

    TRACE (( 4, "[Send_Data]:Inside Send_Data function"));
    Write = wip_write(canal_TCP,buffer,wm_strlen(buffer));
    //Write = wip_write(Channel,globalBuffer,wm_strlen(globalBuffer));
    TRACE (( 4, "[Send_Data]:Resultado de write: %d",Write));
    
    if(Write>0)
    {
       /*Send the data to the remote party*/
       TRACE (( 1, "%d bytes sent to the remote Server",Write));
       retSetOpts = wip_setOpts(canal_TCP,WIP_COPT_RESET_CEV_WRITE,1,WIP_COPT_END);
       if(retSetOpts == 0)
       {
          TRACE (( 1, "set WIP_COPT_RESET_CEV_WRITE"));
       }
       adl_atSendResponsePort(ADL_AT_INT,ADL_PORT_UART1,"\r\nOK\r\n");
    }
    else {
       switch(Write)
       {
             case WIP_CERR_CSTATE:
                  /* The channel is not ready to accept data */
                  TRACE (( 1, "Write Error: WIP_CERR_CSTATE"));
                  break;
             case WIP_CERR_NOT_SUPPORTED:
                  /* This channel does not support data writing operation */
                  TRACE (( 1, "Write Error: WIP_CERR_NOT_SUPPORTED" ));
                  break;
       }
    }
    return Write;
}

Thank u for advance.


#2

hi,
As for my understanding is concerned,
Maximum data packet size depends on the subscribed flow. For GPRS it’s 1500bytes.Just try out sending data higher than 512 bytes but lesser than 1500 bytes.

regards
akhil


#3

Hiya,

Your SendData() function is not quite right.

If you very carefully read the WIP wip_write() documentation, you will find out that the return value from wip_write() is the number of bytes copied from YOUR buffer to the GPRS buffer. This may not be all of the data in your buffer!

The API notes:
When return value of wip_write function is zero or write attempt writes less data than the requested data, then an application must wait for WIP_CEV_WRITE event before calling wip_write function again.

If you look at the ftp_put example provided with the wip plugin, you will note a method used to walk your way through your data buffer if it is bigger than the WIP internal buffer. Look in the WIP_CEV_WRITE event…

This bit me too…

ciao, Dave


#4

Thanks for the reply!!, but im having torbule to download large files!, there is a limit size to download?, how can i download a big size file?. Thank u so much for advance.