提交 4c56e269 编写于 作者: B bernard.xiong

fix udpecho send bug.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@314 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 612898fe
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
void udpecho_entry(void *parameter) void udpecho_entry(void *parameter)
{ {
static struct netconn *conn; struct netconn *conn;
static struct netbuf *buf; struct netbuf *buf;
static struct ip_addr *addr; struct ip_addr *addr;
static unsigned short port; unsigned short port;
conn = netconn_new(NETCONN_UDP); conn = netconn_new(NETCONN_UDP);
netconn_bind(conn, NULL, 7); netconn_bind(conn, IP_ADDR_ANY, 7);
while(1) while(1)
{ {
...@@ -22,6 +22,9 @@ void udpecho_entry(void *parameter) ...@@ -22,6 +22,9 @@ void udpecho_entry(void *parameter)
/* send the data to buffer */ /* send the data to buffer */
netconn_connect(conn, addr, port); netconn_connect(conn, addr, port);
/* reset address, and send to client */
buf->addr = RT_NULL;
netconn_send(conn, buf); netconn_send(conn, buf);
/* release buffer */ /* release buffer */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册