WiFiClient.connect ("192.168.0.10", 80) does not time out

I’m in trouble because the process stops without a timeout when connecting the WiFi Client.

Homepage sample
Wi-Fi Client Example Code


If you specify an IP address that does not exist in the connection destination HOST name in the code in, the timeout does not occur. If you specify the name of the host (example: “expaa55.com”), a timeout will occur.
Does anyone know how to cause a timeout even if you specify an IP address?
The latest version of the farm is written.
20210519-seeed-ambd-firmware-rpc-v2.1.3
Serial.begin (115200);
delay (1000);

WiFi.mode (WIFI_STA);
WiFi.disconnect ();
delay (2000);

WiFi.begin (ssid, password);

while (WiFi.status ()! = WL_CONNECTED) {
    delay (500);
}

const char * host = "192.168.0.10"; // This is blocked. <-NG
//const char * host = "expaa55.com"; // This is timeout. <-OK

WiFiClient client;

if (! client.connect (host, 80)) {
    Serial.println ("Connection failed."); // Don't enter here
    return;
}

I have the same problem, in my case I have to use a fixed ip address. I’m surprised that we seem to be the only ones having this problem
I already opened an issue in github Seeed_Arduino_rpcWiFi but no response yet.
https://github.com/Seeed-Studio/Seeed_Arduino_rpcWiFi/issues/29

I’m also having the same problem.

When sending data with GitHub - AmbientDataInc/Ambient_ESP8266_lib: IoTデーター可視化サービス「Ambient」のESP8266/ESP32用ライブラリーと、温度・湿度センサー、心拍モニター、消費電流モニターなどのサンプルプログラムです。, it may freeze after exceeding the timeout period.
I’m using Seeed_Arduino_rpcWiFi 1.0.6.

Seeed_Arduino_rpcWiFi says “Maximum Compatible with ESP32 wifi library”, but I would like to know how the timeout processing is different.

Hi there,
Does the IP or name resolve from a command line?
Perhaps the DNS is not configured correctly or Blocked?
Is it a DHCP address?
Can you ping the IP address?
HTH
GL :slight_smile: PJ
Try changing it to a Static address. and define the NameServer.
my.02