- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 iserr_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*/
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found my problem! I forgot to free pbuf after usage.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page