Altera_Forum
Honored Contributor
21 years agoLWIP-Stand-Alone crashes
For some or other reason after receiving 32 UDP packets the ENTIRE LWIP networking stack stops responding – no UDP no TCP to ICMP nothing. It does not seem to matter what size the packet is. Is there any way to reset the pbuf address / count?
Here is a code snippit that shows what the udp_recv(…) does.static void udp_client_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
{
int i;
static int remainingframesize = FRAMESIZE;
static int totalcopied = 0;
while(remainingframesize > 1)
{
remainingframesize = remainingframesize - p->tot_len;
for(i = 0; i < p->tot_len; i++)
{
printf("%c",*((char*) p->payload+i));
}
break;
}
if( remainingframesize < 1)
{
printf("\n\nENTIRE FRAME RECEIVED. %d chars remaining"
,remainingframesize);
remainingframesize = FRAMESIZE;
totalcopied = 0;
}
}
/*-------------------------------------------------------------------*/
void udp_client_init(void)
{
struct udp_pcb *pcb;
struct pbuf *pbuffer;
/* Allocate memory for the structure that holds pbuffer. */
pbuffer = mem_malloc(sizeof(struct pbuf));
pcb = udp_new();
udp_bind(pcb, IP_ADDR_ANY, 1234);
printf("\nport 1234 is now open\n");
/* Tell UDP that we wish to be informed of incoming data by a call
to the echo_recv() function. */
udp_recv(pcb, udp_client_recv, NULL);
}
/*-------------------------------------------------------------------*/ If anyone has any ideas on how I could receive a 1MB file using UDP. Any suggestions would be really great. If anyone has an idea of the bandwidth that I can expect using UDP from LWIP-Stand Alone that would be nice too. Thanks in advance.