diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 8e0edf80f69..ee704c2dbca 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -246,7 +246,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout_ms) FD_ZERO(&fdset); FD_SET(sockfd, &fdset); tv.tv_sec = _timeout / 1000; - tv.tv_usec = 0; + tv.tv_usec = (_timeout % 1000) * 1000; #ifdef ESP_IDF_VERSION_MAJOR int res = lwip_connect(sockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr));