HTTP server on AP and STA
Posted: Tue Aug 21, 2018 11:36 am
Hi,
I am trying to run and HTTP server on both SoftAP and STA interfaces simultaneously so that the same web page is displayed when connecting to the ESP32 via the SoftAP or when connecting to the same router as the ESP32 STA interface.
When in STA mode, I can access the web page.
However, when in SoftAP+STA, I can only access the web page by connecting to the SoftAP.
If I connect to the same router as the STA, I can ping the IP address of the ESP32, but I cannot get an answer form the netconn interface using a web browser.
Any idea why the netconn would only work on the SoftAP when both interfaces are active?
Below is my netconn binding code.
Thanks.
I am trying to run and HTTP server on both SoftAP and STA interfaces simultaneously so that the same web page is displayed when connecting to the ESP32 via the SoftAP or when connecting to the same router as the ESP32 STA interface.
When in STA mode, I can access the web page.
However, when in SoftAP+STA, I can only access the web page by connecting to the SoftAP.
If I connect to the same router as the STA, I can ping the IP address of the ESP32, but I cannot get an answer form the netconn interface using a web browser.
Any idea why the netconn would only work on the SoftAP when both interfaces are active?
Below is my netconn binding code.
Thanks.
Code: Select all
void HTTP_Server(void)
{
struct netconn *conn, *newconn;
err_t err;
thisPrintf(("HTTP Server: Start\n"));
conn = netconn_new(NETCONN_TCP);
netconn_bind(conn, IP_ADDR_ANY, 80);
netconn_listen(conn);
do
{
err = netconn_accept(conn, &newconn);
if(err == ERR_OK)
{
thisPrintf(("HTTP Server: New Conn\n"));
http_server_netconn_serve(newconn);
netconn_delete(newconn);
}
vTaskDelay((TickType_t)10); /* allows the freeRTOS scheduler to take over if needed */
}while(err == ERR_OK);
netconn_close(conn);
netconn_delete(conn);
}