/*GetNaviMessage(&p->payload,p->len);*/
memset(recdata,0,sizeof(recdata));
memcpy((char *)recdata,p->payload,p->len);
/* Tell the client that we have accepted it */
udp_send(upcb, p);
/* free the UDP connection, so we can accept new clients */
udp_disconnect(upcb);
/* Create a new UDP control block */
udpTaskPCB = udp_new(); //创建一个新的UDP控制块
if (udpTaskPCB)
{
/* Bind the udpTaskPCB to the UDP_PORT port */
/* Using IP_ADDR_ANY allow the udpTaskPCB to be used by any local interface */
err = udp_bind(udpTaskPCB, IP_ADDR_ANY, UDP_SERVER_PORT); //绑定本地IP地址及端口
if(err == ERR_OK)
{
/* Set a receive callback for the upcb */
udp_recv(udpTaskPCB, udp_echoserver_receive_callback, NULL); //注册接收数据回调函数
}
else
{
udp_remove(udpTaskPCB);
printf("can not bind pcb");
}
}
else
{
printf("can not create pcb");
}
}