ESP8266 Developer Zone The Official ESP8266 Forum 2018-05-10T17:35:27+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=9887 2018-05-10T17:35:27+08:00 2018-05-10T17:35:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=9887&p=20323#p20323 <![CDATA[求助!! esp8266如何在softap模式下获取广播地址]]> 是否只能通过指定IP地址和子网掩码的方式来变相的指定广播地址?但是这种方式通用性极差。

Code:

    struct ip_info info;
    IP4_ADDR(&info.ip, 192, 168, 5, 1); // set IP
    IP4_ADDR(&info.gw, 192, 168, 5, 1); // set gateway
    IP4_ADDR(&info.netmask, 255, 255, 255, 0); // set netmask
    wifi_set_ip_info(SOFTAP_IF, &info);
    struct dhcps_lease dhcp_lease;
    IP4_ADDR(&dhcp_lease.start_ip, 192, 168, 5, 100);
    IP4_ADDR(&dhcp_lease.end_ip, 192, 168, 5, 105);
    wifi_softap_set_dhcps_lease(&dhcp_lease);
    wifi_softap_dhcps_start(); // enable soft-AP DHCP server
   
    IP4_ADDR(&broadcast, 192, 168, 5, 255); //指定广播地址

Statistics: Posted by gaolei17 — Thu May 10, 2018 5:35 pm


]]>