[ESP8266] Client lässt Server 'abschmieren'

Hallo,
dies hier ist mein Projekt jetzt etwas weiter. Zunächst der Client:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "..";
const char* password = "Exxx";

IPAddress server(192,168,178,29);

WiFiClient client;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// We start by connecting to a WiFi network

/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

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

} // WiFi läuft über WPA2

//Ab hier im WiFi: Client und Server unterscheiden sich

if(client.connect(server,80))
{
client.println("bin da");
}
else
{
//Fehler
}
;
}

void loop() {
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(200); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}

und hier der Server:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "..";
const char* password = "Exxx";

boolean Erster;
int counter;

char Buffer[200];

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// We start by connecting to a WiFi network
Serial.begin(115200);

/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
WiFiServer server(80);
Serial.print("Hinter Server init");
// WiFi läuft mit WPA2

// Ab hier: WiFi intern/Client und Server unterscheiden sich
Serial.print("Vor Client init");
WiFiClient client;

server.begin();
Serial.print("Hinter Server Start");
client.flush();
Serial.print("Hinter Client 'durchspülen'");
counter=0;
Erster=false;
Serial.print("Direkt vor dem if");
if(client.available()>0)
{
if(Erster)
{Serial.println("Server hat was gesendet");
}
else
{
Erster=false;
}
Buffer[counter]=client.read();
counter++;
Serial.println(Buffer);
}
else
{
Serial.print("Keine Daten da");
}

}

void loop() {

digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(400); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)

digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(800); // Wait for a second
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)

}
und hier das Ergebnis der Ausgabe des Server:

Exception (9):
epc1=0x40203207 epc2=0x00000000 epc3=0x00000000 excvaddr=0xc2f0c13e depc=0x00000000

ctx: sys
sp: 3ffffd30 end: 3fffffb0 offset: 01a0

stack>>>
3ffffed0: 3ffe9024 00000000 00000000 402031a4
3ffffee0: 3fff0c34 3ffeffdc 3ffeffdd 40203230
3ffffef0: 00000036 00000000 00000000 4020c8e2
3fffff00: 1db2a8c0 00000000 00000000 00000000
3fffff10: 00000000 00000036 3fffff80 3fff0d72
3fffff20: 3fff0180 3fff0d54 3fff0268 40210995
3fffff30: 00000014 000000d8 000000d8 3fff0180
3fffff40: 3fffdc80 3fff0724 3fff0944 3fff077c
3fffff50: 00000008 3fff0180 3fff0d54 4020a0e9
3fffff60: 3fffdc80 3fff0724 3fff0944 4010453c
3fffff70: 4022757a 3fff0724 3fff0944 4022758c
3fffff80: 3fff0d64 3fff0d54 00000002 00000000
3fffff90: 4022246f 00000000 3fff0944 402294cf
3fffffa0: 40000f49 3fffdab0 3fffdab0 40000f49
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v614f7c32
~ld
Hinter Server initVor Client initHinter Server StartHinter Client 'durchspülen'Direkt vor dem ifKeine Daten da

Es passiert nach einem Reset des Client, also der Server wird nicht verändert. Da die Ausgabe normal erscheint (am Ende) findet der Absturz also zu Beginn statt und er fängt sich auch wieder. Im Client ist nichts zu erkennen.

Das zählt zu den direkten Ergebnissen, nicht zu den 'dummen' Fragen. Da es projektspezifisch ist, wird es kaum schon mal existieren. Wie kann ein Server überhaupt so vom Client abhängen?

Tschüß

Manni

Ach ja, der Server und der Client blinken anschließend ganz normal.

If you want to continue in German, get a moderator to move your post to the German part of the forum.

It is usual to see this in the loop of a web server:

server.handleClient() ;

but look at a full example here: A Beginner's Guide to the ESP8266

If you want to debug your stack trace, you can look here: Debugging — ESP8266 Arduino Core 3.1.1-19-gbe02af05 documentation

Hello,
first off all: many thanks! And excuse my fault, I was a little bit concerned about the errors in my code and so I used the wrong language.

But again one question: Why the compiler says that there was no methode '.on' in class 'server'? The example is on WiFiEXP8266 Lib an so it is no difference expectable.

server.begin();
server.on("/", handleRoot);
'class WiFiServer' has no member named 'on'

greetings

Manni

Hello,
o.k. same lib is not allways the same. I just have noticed that the icludes are a litllebit different here.

greetings and .... forget the last

btw: There's no german 'ESP8266' topic

Manni

Hallo,
der Rat war ein deutsches Forum benutzen: Das Problem nur: es gibt dieses Forum nicht auf deutsch. Nur für den Arduino, nicht aber für den ESP8266. Trotzdem hier ab jetzt auf deutsch (das bisschen, das noch kommt):

Dieses Thema ist damit durch. Von jetzt an sind andere Themen wichtig (immer noch ESP, aber spezieller). Hier kann also zu gemacht werden.

Tschüß

Manni

ManfredP:
Hallo,
der Rat war ein deutsches Forum benutzen: Das Problem nur: es gibt dieses Forum nicht auf deutsch. Nur für den Arduino, nicht aber für den ESP8266. Trotzdem hier ab jetzt auf deutsch (das bisschen, das noch kommt):
. . .

Nicht genau. Hier: Deutsch - Arduino Forum ist das Arduino Forum auf deutsch und ESP8266 ist da auch nicht völlig unbekannt. Einfach ein neue Thread eröffnen genau wie du es hier gemacht hast.