Http service imposible to run website in second device.

mateuszfio
Posts: 3
Joined: Fri Jul 09, 2021 11:44 am

Http service imposible to run website in second device.

Postby mateuszfio » Fri Jul 09, 2021 12:56 pm

I'm connect two devices to esp32 access point. In first device I can see my website. But in second device nothing happen.

Example logs:
W (38333) httpd: httpd_accept_conn: error in accept (23)
W (38333) httpd: httpd_server: error accepting new connection
W (38336) httpd: httpd_accept_conn: error in accept (23)
W (38341) httpd: httpd_server: error accepting new connection

:D

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Http service imposible to run website in second device.

Postby ESP_Sprite » Sat Jul 10, 2021 1:34 am

Well, from the information you posted, all I can say is that you may or may not have an issue. Care to post more info? Link to the source code, hardware you're running on, full logs, any differences between devices, ESP-IDF version, SDK you're using, something like that?

mateuszfio
Posts: 3
Joined: Fri Jul 09, 2021 11:44 am

Re: Http service imposible to run website in second device.

Postby mateuszfio » Mon Jul 12, 2021 5:16 am

ESP-IDF = v3.3.1
devboard = olimex esp32-evb

Code: Select all

    tcpip_adapter_init ();
    
    static httpd_handle_t server = NULL;
    
    ESP_ERROR_CHECK(esp_event_loop_init(onWiFiEvent, &server));

    wifi_init_config_t configInit = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK    (esp_wifi_init        (&configInit));
    ESP_ERROR_CHECK    (esp_wifi_set_storage (WIFI_STORAGE_RAM));
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA));
    
    wifi_config_t      configWiFi;
    memset             (&configWiFi, 0, sizeof (wifi_config_t));
    memcpy             (configWiFi.sta.ssid    , settings.Station.Ssid    , SSID_LEN);
    memcpy             (configWiFi.sta.password, settings.Station.Password, PASSWORD_LEN);
    
    ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &configWiFi));
    
    memset(&configWiFi, 0, sizeof(wifi_config_t));
    memcpy(configWiFi.ap.ssid, settings.SoftAp.Ssid, SSID_LEN);
    memcpy(configWiFi.ap.password, settings.SoftAp.Password, PASSWORD_LEN);
    
    configWiFi.ap.ssid_len       = Settings::GetInstance().WiFi.SoftApSsid.size();
    configWiFi.ap.max_connection = 2;
    configWiFi.ap.authmode       = WIFI_AUTH_WPA_WPA2_PSK;
    
    ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &configWiFi));
    
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA));

Code: Select all

    httpd_handle_t server = NULL;
    httpd_config_t config = HTTPD_DEFAULT_CONFIG();
	config.max_uri_handlers = 12;
    
    const httpd_uri_t hello = {
        .uri = "/hello",
        .method = HTTP_GET,
        .handler = GetHandler,
        /* Let's pass response string in user
         * context to demonstrate it's usage */
     .user_ctx = (void*)"Hello World!"
    };
        
    LOG(MODULE, "Start");
    // Start the httpd server
    LOG(MODULE, "Starting server on port: '%d'", config.server_port);
    if (httpd_start(&server, &config) == ESP_OK) {
        // Set URI handlers
        LOG(MODULE, "Registering URI handlers");

	    httpd_register_uri_handler(server, &hello);
	    
        return server;

Who is online

Users browsing this forum: No registered users and 84 guests