Chat freely about anything...

User avatar
By sej7278
#10019 i'm doing this, its the freertos sdk, but don't think its much/any different, this is for static ip, not tried dhcp yet as it makes no sense for a server:

Code: Select all    // setup wifi mode
    wifi_set_opmode(STATION_MODE);

    // wifi config
    {
        struct station_config *config = (struct station_config *)zalloc(sizeof(struct station_config));
        sprintf(config->ssid, "MYESSID");
        sprintf(config->password, "MYPASSWORD");
        wifi_station_set_config(config);
        free(config);
    }

    // ip config
    {
        struct ip_info ipinfo;
        ipinfo.gw.addr = ipaddr_addr("192.168.1.1");
        ipinfo.ip.addr = ipaddr_addr("192.168.1.2");
        ipinfo.netmask.addr = ipaddr_addr("255.255.255.0");
        wifi_set_ip_info(STATION_IF, &ipinfo);
    }
User avatar
By rith87
#10496 @sprite_tm: I have some strange observations when working with your stack from http://git.spritesserver.nl/espeink.git/.

    I'm able to connect to the local wifi network via the form on 192.168.4.1.
    If I specify a hostname on the network, the http request to the machine succeeds.
    If I specify the hostname's IP address and call espconn_connect() directly without espconn_gethostbyname(), the espconn_connect() call returns -4 (ESPCONN_RTE, routing problem)
    If I specify the hostname's IP address with the IoT demo stack, the http request to the machine succeeds.

Do you have any idea why I'm seeing this behavior? I guess what I'm asking is if there is some difference between the IoT demo and httpd stacks that might prevent ESP8266 from connecting to an IP address directly?

PS: The 192.168.4.1 hosted on the IoT demo example can be accessed from my Ubuntu machine; but the one hosted on the httpd stack can only be accessed from my non-Linux devices.