Skip to content

WiFiClient.cpp::setTimeout not working properly? #2016

Closed
@cyberman54

Description

@cyberman54

I'm trying to set a connection timeout before opening a wifi connection.
My code is:

const uint32_t RESPONSE_TIMEOUT = 30;
WiFiClientSecure client;
client.setTimeout(RESPONSE_TIMEOUT);
if (!client.connect(currentHost.c_str(), port)) {
    ESP_LOGI(TAG, "Cannot connect to %s", currentHost.c_str());
    display(3, " E", "connection lost");
    goto failure;
  }

This openes the wifi connection successful, but it logs this error:
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9

0x1006 is defined as
#define SO_RCVTIMEO 0x1006 /* receive timeout */

but what means error 9 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions