Socket error on fd48

Hello,

I’m currently working on a project. But unfortunately im not able to get even the first setup working. This due some connection issues with blynk clouds. When i just try to use the simple Blynk.begin() function is get an error that the DNS of blynk-cloud.com cant be resolved. When i ping this site i get no response. I then looked around at this forum and found that there’s is a newer, more used server. blynk.cloud . When i ping this i get an IPaddress, which i now use in the example below. Unfortunately i now get a different error which i haven’t been able to resolve yet. Error is as following:

437756][E][WiFiClient.cpp:268] connect(): socket error on fd 48, errno: 104, “Connection reset by peer”

I hope someone can help me.

platform = espressif32
board = esp32dev
framework = arduino
lib_deps = blynkkk/Blynk@^1.1.0

IPAddress BlynkServer(46, 101, 217, 214);
//==============================================================================
//----------------------------- Function prototypes ----------------------------
//==============================================================================
void setup_blynk()
{
  WiFi.mode(WIFI_STA);

  WiFi.begin(SSID, PASS);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connection Successful");
  Serial.print("The IP Address of ESP8266 Module is: ");
  Serial.print(WiFi.localIP()); // Print the IP address

  Blynk.config(BLYNK_AUTH_TOKEN, BlynkServer, 8442);
  // Blynk.config(BLYNK_AUTH_TOKEN);
  Blynk.connect();
}

void setup()
{
  Serial.begin(115200);
  setup_blynk();
  // Blynk.begin(BLYNK_AUTH_TOKEN, SSID, PASS, BlynkServer, 80);
}

void loop()
{
  Blynk.run();
}

Have you tried the examples sketch from the Blynk edgent example?

Start with a base sketch that works, later you can start to play with it.

We all know the examples provided works flawlessly. So start there.

Thanks for your response. I have tried. But then i get the following output

[2660] Connecting to blynk-cloud.com:443
[ 2702][E][WiFiGeneric.cpp:1476] hostByName(): DNS Failed for blynk-cloud.com
[ 2702][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -1
[2705] Secure connection failed

NOTE: When i ping this dns i get no response

The Blynk IoT server address is blynk.cloud and you should use the regiona subdomain prefix rather than the IP address…

https://docs.blynk.io/en/blynk.cloud/troubleshooting

Pete.

Thanks for your reply Pete,

Could you tell me which function i can use to set this subdomain prefix? Looking at the IP-Addresses i was using the one based in Frankfurt. Changing this, again by giving the IPaddress to Blynk.config() to the one based on london, resulted in the same error:

[ 7675][E][WiFiClient.cpp:268] connect(): socket error on fd 48, errno: 104, “Connection reset by peer”

Did you read the link I provided?

Pete.

Hello Pete,

I seemed to have solved the issue. For some reason i did not get a confirmation in my serial monitor. But using the IP-address, which my cmd returned after pinging blink.cloud with port 80. Seemed to have solved my issue. Thanks for your time

Not printing was resolved by defining it above the import of blynk

You shouldn’t be using IP addresses unless you absolutely have to.
Blynk introduced the subdomains for each of the cloud servers because IP addresses - especially IPV4 ones - might change. It’s far better to use the subdomain prefix on blynk.cloud as I suggested.

Pete.