CUBEMX+探索者STM32F407+LAN8720A+FreeRTOS+LWIP 回显例程(二)
一、前言
二、修改源码
1、添加‘tcpecho.c’与‘udpecho.c’文件
tcpecho.c:
#include "lwip/opt.h"
#if LWIP_NETCONN
#include "lwip/sys.h"
#include "lwip/api.h"
#define TCPECHO_THREAD_PRIO ( tskIDLE_PRIORITY + 4 )
/*-----------------------------------------------------------------------------------*/
static void tcpecho_thread(void *arg)
{
struct netconn *conn, *newconn;
err_t err, accept_err;
struct netbuf *buf;
void *data;
u16_t len;
LWIP_UNUSED_ARG(arg);
/* Create a new connection identifier. */
conn = netconn_new(NETCONN_TCP);
if (conn!=NULL)
{
/* Bind connection to well known port number 7. */
err = netconn_bind(conn, NULL, 7);
if (err == ERR_OK)
{
/* Tell connection to go into listening mode. */