Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

problem receiving data

Altera_Forum
Honored Contributor II
1,155 Views

Hi 

 

I have build a small project which receives data sended by tcp. This works fine until the number of the sended packets exeeds 32. After receiving the 32nd packet the NIOS hangs. 

My receiving function is 

err_t port_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { char *src;  err_t err2;  if(err==ERR_OK && p!=NULL)  {    src=(char *) p->payload;    tcp_recved(pcb, p->tot_len);    if(src==0x6D)      printf("%s\n",src);    else      printf("0x%x\n",src);  }  printf(">>> %d\n",p->tot_len);    err2=tcp_write(pcb,src,p->tot_len,1);  if(err2==ERR_OK)  {    tcp_ack_now(pcb);      exec_command(src);    packnumber++;    printf("# %d\n",packnumber);/*prints the number of packets*/    //send finished cmd    return ERR_OK;  }  else    return ERR_BUF;  exec_command(src);/*calls an execute function*/ }
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
455 Views

I found my problem! I forgot to free pbuf after usage.

0 Kudos
Reply