<type>的值不能分配给<type>的实体(在LwIP上)

时间:2017-03-02 09:26:48

标签: networking freertos lwip stm32f4

我想使用freeRTOS使用我的STM32F4开发板实现网络项目。一开始。我使用tcp / udp echo服务器。这是我的代码

static struct netconn *conn;
static struct netbuf *buf;
static struct ip_addr *addr;
static unsigned short port;

   static void udpecho_thread(void *arg)
{
  err_t err;

  LWIP_UNUSED_ARG(arg);
  conn = netconn_new(NETCONN_UDP);
  if (conn!= NULL) {
    err = netconn_bind(conn, IP_ADDR_ANY, 7);
    if (err == ERR_OK) {
      while (1) {
        buf = netconn_recv(conn,&buf);

        if (buf!= NULL) {
          addr = netbuf_fromaddr(buf);
          port = netbuf_fromport(buf);
          netconn_connect(conn, addr, port);
          buf->addr = NULL;
          netconn_send(conn,buf);
          netbuf_delete(buf);
        }
      }
    } else {
      printf("can not bind netconn");
    }
  } else {
    printf("can create new UDP netconn");
  }
}

但我在buf = netconn_recv(conn,&amp; buf)和buf-&gt; addr = NULL时出错。它显示:

  

“err_t”类型的值不能分配给“struct netbuf *”类型的实体

和buf-&gt; addr:

  

“int”类型的值无法分配给“ip_addr_t”类型的实体

我如何解决?

0 个答案:

没有答案
相关问题