使用cubemx配置lwip 开启dhcp模式
sta
tic void http_server_netconn_thread(void *arg)
{
struct netconn *conn, *newconn;
err_t err, accept_err;
/* Create a new TCP connection handle */
conn = netconn_new(NETCONN_TCP);
if (conn!= NULL)
{
/* Bind to port 80 (HTTP) with default IP address */
err = netconn_bind(conn, NULL, 80);
if (err == ERR_OK)
{
/* Put the connection into LISTEN state */
netconn_listen(conn);
while(1)
{
/* accept any icoming connection */
accept_err = netconn_accept(conn, newconn);
if(accept_err == ERR_OK)
{
/* serve connection */
http_server_serve(newconn);
/* delete connection */
netconn_delete(newconn);
}
}
}
}
}然而进过一次再也没进去 电脑测试设置好tcp客户端和目地地址名为i有用 求大神