Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Problems with receiving UDP-messages

Hi all,

send UDP-messages isn't a problem anymore. But now, when I try to send a message from pc to nios II, my data doesn't arrive and ethereal tells me that the IP-header checksum is 0x0000. When I chat with the program (it's a udp-version of a small chatprogram) it works fine. We written it ourselves, but for some reason, I doesn't cooperate with my NIOS II.

This is what I use for receiving data:

***************************************************************

while(1)

{

lan91c111if_service(&netif);

pcb = udp_new();

udp_recv(pcb, udp_callback, 666);

udp_bind(pcb, IP_ADDR_ANY, 666);

// udp_callback_function(recvBuffer, pcb, p, &destIpAddr, 666);

}

***************************************************************

CALLBACK

***************************************************************

void udp_callback_function(void *recvBuffer, struct udp_pcb *pcb, struct

pbuf *p, struct ip_addr *ipaddr, u16_t port)

{

recvBuffer = p->payload;

printf(recvBuffer);

pbuf_free(p);

udp_remove(pcb);

}

**************************************************************

Could anyone tell me what I'm doing wrong!? Thanks in advance.

Danny

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I know what the problem is:

    in lwipopts.h PBUF_POOL_SIZE is defined as 32. When I sent 32 strings it stops. But m question is: how do I clear it. There must be a way. When I use pbuf_free, it doesn't seem to be much of help.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No problems anymore also fixed it.... Only one question left: how large is the max size of a packages which is received by NIOS?!

    cheers,

    Danny