So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By DAD405
#69521 Sorry for my maybe dumb question, but I didn't get it.

I try to build a simple Wifi-Button setup based on an article I found in Web:
http://www.mikrocontroller-elektronik.d ... 266-modul/

Everything works fine (wake up, get config, connect to wifi...)
until the get url should be done. All I get at this point is connection refused.
Copying the url to a Browser works fine.

I cant figure aout the Problem.
Webserver is (and should be) a Microsoft iis.


Debug serial:
Code: Select all`"⸮⸮2⸮⸮)WMBAT⸮F⸮L   &ab⸮⸮⸮'⸮⸮Start

Hostname: WifiBtn-1458400
Zyklus: 9
U Batt:  2.74V
Connecting to IbZ
URL:  http://srvma-web001/WifiButton/action.php?Passwort=xxxxxx&
Nachricht:  Testmessage Brötchenwagen
CCC
WiFi connected
Signal strength: -69dBm
IP address:
10.101.10.101
connecting to http://srvma-web001/WifiButton/action.php?Passwort=xxxxxx&UBatt=2.74V&WachNr=9&Empfang=-69&Nachricht=Testmessage+Br%C3%B6tchenwagen

http code: -1

[HTTP] GET... failed, error: connection refused

Go to Deepsleep


Code snipped (basical the simple get code from example):
Code: Select all   // Okay an dieser Stelle sind wir mit dem Wifi verbunden...
  LEDweiss();
 
  int32_t rssi = wifi_station_get_rssi(); // Signalstärke einlesen

  url = url + "UBatt=" + Ubatt;      //Parameter Bat Spannung
  url = url + "&WachNr=" + String(Zyklus[0] - 1); //Aufwachzyklus
  url = url + "&Empfang=" + String(rssi); //Parameter Signalstärke
  url = url + "&Nachricht=" + urlencode(nachricht);

#if defined  seriell
  //Serial.begin(115200);
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.print("Signal strength: ");
  Serial.print(rssi);
  Serial.println("dBm");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.print("connecting to ");
  Serial.println(url);
#endif

  LEDblau();
  http.begin(url); //HTTP
  int httpCode = http.GET();

#if defined  seriell
  Serial.println("");
  Serial.print("http code: ");
  Serial.println(httpCode);
#endif
  if (httpCode > 0) {
    // HTTP header has been send and Server response header has been handled
   //OK...
   LEDrotgruen();
# if defined  seriell
    Serial.println("");
    Serial.printf("[HTTP] GET... code: %d\n", httpCode);
#endif
    // file found at server
    if (httpCode == HTTP_CODE_OK) {
      String payload = http.getString();
      # if defined  seriell
           Serial.println("");
           Serial.println(payload);
      #endif
    LEDgruen();
    delay(5000);
    LEDoff();
    }
  } else {
    //ERROR....
#if defined  seriell
    Serial.println("");
    Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
    Serial.println("");
    Serial.println("Go to Deepsleep");
    WiFi.forceSleepBegin();  // Wlan aus


What am I doing wrong?
User avatar
By DAD405
#69654 Is there a way to get more debug info from the Http client out to the serial port?

By enabling http logging on the Web server it looks like no complete http reqeuest was made and therefore no log has been written. (no 200, no 400, simple nothing)
(the reqeuest via browser gives Log imedeately )
User avatar
By DAD405
#69667 Yes, the srvma-web001 is a local server.
It is resolved by local DNS

A tablet using the same wifi gets this DNS server on wifi connection.
Whith this all is okay.

But how can i confirm the esp gets the dns too?

I will try to use IP-address for the link, but it should bei possible to use dns.
Or am I wrong?