HTTPClient Get always error: connection refused
Posted: Mon Aug 28, 2017 9:48 am
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 snipped (basical the simple get code from example):
What am I doing wrong?
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?