[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Is the pbuf_alloc usage correctly?

From: bingsen xie
Subject: [lwip-users] Is the pbuf_alloc usage correctly?
Date: Mon, 14 Jun 2004 22:17:32 +0800 (CST)

hello,every one!

I have use the lwip-0.7.1 with UCOS.I write an application with the UDP RAW API.

The program is list following. But my program cann't run stablly.
It seems that the pbuf_alloc cann't correcttly return.
Do you have the relative experience?Can you tell me?

//get a pbuf struct pointer matching with the size of data to be sent.
//and fill the pbuf with data

int prepare_pbuf(struct pbuf* psendata)
 struct pbuf* q;
 int nRet;
 char* ptr;
 char* data;
 long i;
 static char   data_buffer[UDP_SEND_PACKAGE_SIZE];

//Read my target send data
 if(nRet<=0) return -1; 
#ifdef __DEBUG 
 printf("the nRet is %d",nRet);
#endif __DEBUG

 if(psendata==NULL) return -1;
 data=""> for(q = psendata; q != NULL; q = q->next)
  for(i = 0; i <q->len;i++)
 return 0; 

//release the pbuf pointer
void release_pbuf(struct pbuf* pdata)
//send a lot of data to remote
void voice_udp_sendout()
 struct udp_pcb * upcb_client;
 err_t err_code;
 char* ptr;  
 struct pbuf* psendata=NULL;
  printf("client cann't create upcb\n");
  return ;

  printf("cann't connect to remote server\n"); 
  return ;


// after some times successfully it will alway run into here!
//I think it is because I use pbuf_alloc error.But I don't know whu my
//usage about pbuf_alloc is error

   //printf("Cann't Get Data for Sending!\n");
    printf("Mem Error\n");
  else if(err_code==ERR_USE)
   printf("Error used\n");
  else printf("Send OK");

int voice_udp_client_init()
 sys_thread_new(voice_udp_sendout, NULL,2);  
 return 0;

Do You Yahoo!?
reply via email to

[Prev in Thread] Current Thread [Next in Thread]