📄 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);}/*-----------------------------------------------------------------------------------*/voidudpecho_init(void){ sys_thread_new(udpecho_thread, NULL,TCPIP_THREAD_PRIO); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -