Created
November 28, 2011 09:17
-
-
Save iwanbk/1399729 to your computer and use it in GitHub Desktop.
LWIP UDP Echo Server with RAW API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* author : Iwan Budi Kusnanto ([email protected]) | |
*/ | |
#include "lwip/api.h" | |
#include "lwip/sys.h" | |
#include "lwip/udp.h" | |
#include "udpecho_raw_server.h" | |
static void udpecho_raw_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port) | |
{ | |
LWIP_UNUSED_ARG(arg); | |
if(p == NULL) | |
return; | |
udp_sendto(pcb, p, addr, port); | |
pbuf_free(p); | |
} | |
/*-----------------------------------------------------------------------------------*/ | |
void udpecho_raw_server_init(u16_t port) | |
{ | |
struct udp_pcb *pcb; | |
printf("%s() ..........\n", __func__); | |
pcb = udp_new(); | |
udp_bind(pcb, IP_ADDR_ANY, port); | |
/* no need to loop forever */ | |
udp_recv(pcb , udpecho_raw_recv, pcb); | |
} |
hi, what is your "udpecho_raw_server.h" in it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is your "udpecho_raw_server.h" file... can you share it ?