Chat freely about anything...

User avatar
By Albx
#67462 Hello!
I have a problem with connection my esp8266-12e with a server.
my sketch is:
Code: Select all#include <ESP8266WiFi.h>

char* ssidRete;
char* pswRete;

const char* host = "www.google.it";
int count;

void setup() {
  WiFi.mode(WIFI_AP_STA);

  delay(1000);
  Serial.begin(115200); 
  Serial.println("**********");
  ssidRete = "xxxx";
  pswRete ="yyyyy";
  WiFi.begin(ssidRete, pswRete);
  count=0;
}
 void loop() {
  WiFiClient client;

  Serial.println(client.connect(host, 80));
 
  if (!client.connect(host, httpPort)) {
    return;
  }

   if (client.connected()) {
     client.stop();  // DISCONNECT FROM THE SERVER
   } 
   count +=1;
   Serial.println(count);
   Serial.println();
   Serial.println("closing connection");
   delay(200);
 }


it works for 120 request and then crashes with reset esp.
the code of exception is:
Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys


Tanks and sorry for my english
User avatar
By Albx
#67633 Thank you philbowles for the reply.
yes this looks like special code to demo the problem (code is very simplified).
I was wrong in this example to define the client object, which in reality is declared in global scope
but the problem does not change and I'm sure the connection exists.
For precision, code works regularly if I changed host = "www.google.it" with
host = "data.sparkfun.com"
Thanks again for your availability
User avatar
By Albx
#67651 Thank you philbowles for the reply.
yes this looks like special code to demo the problem (code is very simplified).
I was wrong in this example
to define the client object, which in reality is declared in global scope
but the problem does not change and I'm sure the connection exists.
For precision, code works regularly if I changed host = "www.google.it" with
host = "data.sparkfun.com"
Thanks again for your availability