12-09-2009 03:37 PM
I'm implementing a UDP echo server in raw mode on an ML605 board. When I receive a UDP packet my receive function is called, I can see the received data, and I try to send data back out to the ip address and port I received from. Here's my code:
void recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
{
if (p != NULL) {
udp_sendto(pcb, p, addr, port);
pbuf_free(p);
}
}
The problem is that after the udp_sendto function is called, instead of sending out a UDP packet the FPGA sends a gratuitous ARP request. When I try udp_send instead of udp_sendto it sends the correct packet out, but it broadcasts it to port 0 (I had assumed it would send it to the initiator of the packet the recv function was called to handle).
How do I correctly send out a packet?
12-10-2009 08:32 AM - edited 12-10-2009 08:32 AM