提交 a8804d35 编写于 作者: H hduffddybz

correct netconn API usage

上级 a8fadf15
...@@ -23,7 +23,7 @@ void udpecho_entry(void *parameter) ...@@ -23,7 +23,7 @@ void udpecho_entry(void *parameter)
while(1) while(1)
{ {
/* received data to buffer */ /* received data to buffer */
buf = netconn_recv(conn); netconn_recv(conn, &buf);
addr = netbuf_fromaddr(buf); addr = netbuf_fromaddr(buf);
port = netbuf_fromport(buf); port = netbuf_fromport(buf);
...@@ -32,7 +32,7 @@ void udpecho_entry(void *parameter) ...@@ -32,7 +32,7 @@ void udpecho_entry(void *parameter)
netconn_connect(conn, addr, port); netconn_connect(conn, addr, port);
/* reset address, and send to client */ /* reset address, and send to client */
buf->addr = RT_NULL; buf->addr = *IP_ADDR_ANY;
netconn_send(conn, buf); netconn_send(conn, buf);
/* release buffer */ /* release buffer */
...@@ -122,15 +122,15 @@ void tcpecho_entry(void *parameter) ...@@ -122,15 +122,15 @@ void tcpecho_entry(void *parameter)
while(1) while(1)
{ {
/* Grab new connection. */ /* Grab new connection. */
newconn = netconn_accept(conn); err = netconn_accept(conn, &newconn);
/* Process the new connection. */ /* Process the new connection. */
if(newconn != NULL) if(err == ERR_OK)
{ {
struct netbuf *buf; struct netbuf *buf;
void *data; void *data;
u16_t len; u16_t len;
while((buf = netconn_recv(newconn)) != NULL) while((err = netconn_recv(newconn, buf)) == ERR_OK)
{ {
do do
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册