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.