Hey folks,
I'm trying to complete a port of LWIP 1.3.0 raw api. I've used
sockets on
several earlier versions of LWIP in the past, and usually I've hacked
away
at my current installation to upgrade to the latest. Haven't had any
problems.
This time I decided to start from scratch, just to clean up. If
useful, I'll
write up my experience and give it to whoever may want it for the Wiki;
however, I have a few hurdles to get over first. Note that this is my
first
use of the RAW API, plus this is an implementation that doesn't even use
interrupts.
So, I'm running the httpd example code with no problem. This obviously
means that my packet interface is in place, and I'm successfully running
TCP/IP. Now I'm trying to do what should be the simpler step (a UDP
server)
and I'm having problems. I've hunted the mail archives and I see
hints of
the problem, but haven't found anything that clearly fixes me up.
I'm doing something very similar to the udp_echo_server() (found it on
the
mail archive, see below). I have a known working udp client and I'm
seeing
the incoming packets, but never see the outgoing packets on the
interface.
I see it call ip_output_if(), then etharp_output_query(). It sends out a
gratuitous ARP (for some reason), then nothing else. Has anyone seen
this?
Am I missing something in initialization?
Thanks for any suggestions
Ed
void monsrvr_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
struct ip_addr *addr, u16_t port)
{
int i;
struct pbuf *q;
if (p != NULL) {
/* send received packet back to sender */
udp_sendto(pcb, p, addr, port);
/* free the pbuf */
pbuf_free(p);
}
}
void monsrvr_init(void)
{
struct udp_pcb * pcb;
/* get new pcb */
pcb = udp_new();
if (pcb == NULL) {
return;
}
/* bind to any IP address on port 777 */
if (udp_bind(pcb, IP_ADDR_ANY, 777) != ERR_OK) {
return;
}
/* set monsrvr_recv() as callback function
for received packets */
udp_recv(pcb, monsrvr_recv, NULL);
}
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users