?? udpecho.c
字號:
#include "lwip/api.h"
#include "lwip/sys.h"
/*-----------------------------------------------------------------------------------*/
void
udpecho_thread(void *arg)
{
struct netconn *conn;
struct netbuf *buf;
struct ip_addr addr;
char text[] = "This is a Test UDP packet.";
/* create a new connection */
conn = netconn_new(NETCONN_UDP);
/* set up the IP address of the remote host */
addr.addr = htonl(0xc0a80063);
/* connect the connection to the remote host */
netconn_connect(conn, &addr, 7000);
/* reference the text into the netbuf */
netbuf_ref(buf, text, sizeof(text));
while(1)
{
/* send the text */
netconn_send(conn, buf);
}
/* deallocate connection and netbuf */
netconn_delete(conn);
netbuf_delete(buf);
}
/*-----------------------------------------------------------------------------------*/
void
udpecho_init(void)
{
sys_thread_new(udpecho_thread, NULL,TCPIP_THREAD_PRIO);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -