[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] updated raw api UDP echo server example
From: |
Juri Haberland |
Subject: |
[lwip-users] updated raw api UDP echo server example |
Date: |
Thu, 14 Jun 2007 11:29:28 +0200 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20070604) |
Hi Dominik, Kirean, list...
here is an updated version of my little example UDP echo server. It uses
now udp_sendto(), which I totally overlooked the first time...
It would be nice if you could include this in the rawapi.txt or some
other documentation file distributed with the source (and of course:
more documentation on the website, please).
Cheers,
Juri
#include "lwip/udp.h"
#include "lwip/debug.h"
void udp_echo_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct
ip_addr *addr, u16_t port)
{
if (p != NULL) {
/* send received packet back to sender */
udp_sendto(pcb, p, addr, port);
/* free the pbuf */
pbuf_free(p);
}
}
void udp_echo_init(void)
{
struct udp_pcb * pcb;
/* get new pcb */
pcb = udp_new();
if (pcb == NULL) {
LWIP_DEBUGF(UDP_DEBUG, ("udp_new failed!\n"));
return;
}
/* bind to any IP address on port 7 */
if (udp_bind(pcb, IP_ADDR_ANY, 7) != ERR_OK) {
LWIP_DEBUGF(UDP_DEBUG, ("udp_bind failed!\n"));
return;
}
/* set udp_echo_recv() as callback function
for received packets */
udp_recv(pcb, udp_echo_recv, NULL);
}
- [lwip-users] updated raw api UDP echo server example,
Juri Haberland <=
- RE: [lwip-users] updated raw api UDP echo server example, Spies, Dominik, 2007/06/14
- Re: [lwip-users] updated raw api UDP echo server example, Juri Haberland, 2007/06/14
- RE: [lwip-users] updated raw api UDP echo server example, Goldschmidt Simon, 2007/06/14
- Re: [lwip-users] updated raw api UDP echo server example, Juri Haberland, 2007/06/14
- RE: [lwip-users] updated raw api UDP echo server example, Goldschmidt Simon, 2007/06/14
- [lwip-users] DNS client for lwIP raw API, Pettinato, Jim, 2007/06/19
- RE: [lwip-users] DNS client for lwIP raw API, Taranowski, Thomas (SWCOE), 2007/06/27
- RE: [lwip-users] DNS client for lwIP raw API, Pettinato, Jim, 2007/06/27
- [lwip-users] Usage example for DNS client (resolv.c), Pettinato, Jim, 2007/06/19
- RE: [lwip-users] Usage example for DNS client (resolv.c), Goldschmidt Simon, 2007/06/19