Chapter 4. Software framework
// Set up the handle for softap netif
esp_netif_t *ap_netif
// ESP_NETIF_IP_ADDRESS_LEASE_TIME, DHCP Option 51, Set the lease
for distributed IP address
→
uint32_t
dhcps_lease_time
ESP_ERROR_CHECK(esp_netif_dhcps_option(ap_netif,ESP_NETIF_OP_SET,ESP_
NETIF_IP_ADDRESS_LEASE_TIME,&dhcps_lease_time,sizeof(dhcps_lease_
→
time)));
→
// ESP_NETIF_DOMAIN_NAME_SERVER , DHCP Option 6, Set DNS SERVER
// Set the local domain DNS first
esp_netif_dns_info_t dns_info
dns_info.ip.u_addr.ip4.addr
ESP_ERROR_CHECK(esp_netif_set_dns_info(ap_netif,ESP_NETIF_DNS_MAIN,&dns_
info));
→
uint8_t
dns_offer
it is 0, then it means the gw ip of softap is used as the DNS server
→
by default)
→
ESP_ERROR_CHECK(esp_netif_dhcps_option(ap_netif,ESP_NETIF_OP_SET,ESP_
NETIF_DOMAIN_NAME_SERVER,&dns_offer,sizeof(dns_offer)));
→
// ESP_NETIF_ROUTER_SOLICITATION_ADDRESS, DHCP Option 3 Router, Pass 0
make the DHCP Option 3(Router) un-shown (1 by default)
→
uint8_t
router_enable
ESP_ERROR_CHECK(esp_netif_dhcps_option(ap_netif,ESP_NETIF_OP_SET,ESP_
NETIF_ROUTER_SOLICITATION_ADDRESS,&router_enable, sizeof(router_
→
enable)));
→
// ESP_NETIF_SUBNET_MASK, DHCP Option 1, Configure the subnet mask
// If it fails to configure the subnet mask via
please make modifications using esp_netif_set_ip_info
→
4.10.8 [Performance] How to test the bit rate of Wi-Fi modules?
Please use the example
4.10.9 [LWIP] What is the default IP address of ESP8266 SoftAP?
Why do I have problem connecting to router with IP 192.168.4.X in SoftAP + Station mode?
• The default network segment used by ESP8266 SoftAP is 192.168.4.*, and its IP address is
192.168.4.1. When connecting ESP8266 to the router of 192.168.4.X, it cannot distinguish
whether this address indicates its own SoftAP or the external router.
4.10.10 [Connect] How many devices is ESP8266 able to connect in SoftAP mode?
The ESP8266 chip in SoftAP mode supports connecting eight devices at most. This is because the NAT
(Network Address Translation) mechanism used by the ESP8266 chip in SoftAP mode only supports
eight devices at most. However, it should be noted that each connected device will occupy a certain
amount of bandwidth and resources. Therefore, we recommend connecting four devices as too many
devices may affect the performance and stability of the Wi-Fi module.
Espressif Systems
=
esp_netif_create_default_wifi_ap();
=
60;
// The unit is min
=
{0};
=
ESP_IP4TOADDR(8,8,8,8);
=
1;
// Pass 1 to make the modified DNS take effect,
=
0;
iperf
in ESP-IDF for testing.
127
Submit Document Feedback
time␣
ESP_NETIF_SUBNET_MASK,␣
if␣
(0␣
to␣
Release master
Need help?
Do you have a question about the ESP and is the answer not in the manual?