-->
Page 1 of 1

Unsecure & secure connections simultaneously

PostPosted: Mon Jul 03, 2017 9:28 am
by m.maazi
Hi.
I use this example to connect my esp8266 module to a telegram bot:
https://github.com/Gianbacchio/ESP8266-TelegramBot/tree/master/examples/FlashledBot

also I need to get Internet time & I use this function:

Code: Select allvoid get_exip(){
 
  String exip="";
  WiFiClient client;
  if (client.connect("api.ipify.org", 80)) {
    client.println("GET / HTTP/1.1");
    client.println("Host: api.ipify.org");
    client.println();
    while(client.available()){
      exip = client.readStringUntil('\n');
    }
  }
}


After programming the module, it keeps resetting. I found out that the problem is connection conflict but I don't have any clue to solve it. Could you please help me?

Regards!
sorry for my poor English.

Re: Unsecure & secure connections simultaneously

PostPosted: Mon Jul 03, 2017 10:35 am
by martinayotte
Your reset problem is maybe due to something else elsewhere.
But for sure, in the above code, your are sending a request and expect to have response instantaneously, which is wrong !
You should add a delay() before your while(client.available()) or even better waiting for response with something like the following before reading this reponse :

Code: Select all    int timeout = millis() + 5000;
    while (client.available() == 0) {   
      if (timeout - millis() < 0) {
        Serial.println(">>> Client Timeout !");
        client.stop();
        return;
      }
    }

Re: Unsecure & secure connections simultaneously

PostPosted: Mon Jul 03, 2017 11:53 am
by m.maazi
Hi.
Thanks for your response.
I removed the delay and some part of the code to clarify my purpose.
It seems the problem is somewhere else (maybe in the library).
Thanks a lot.

Re: Unsecure & secure connections simultaneously

PostPosted: Wed Jul 05, 2017 5:25 am
by m.maazi
Hi.
I found out that the problem IS in the library. After trimming out small peaces of code, I got some results.
When I use a web server and a HTTPS connection at the same time, the problem appears.
It seems that using them at the same time, exhausts the memory.
Is there any solutions? I use esp-01.
Thanks in advance.

by the way, this is the error:

Code: Select allException (29):
epc1=0x4000e1cc epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000204 depc=0x00000000
: cont
sp: 3fff2ab0 end: 3fff3390 offset: 01a0
>>>stack>>>
fff2c50:  00410000 3fffb7b4 3fffb94c 4022f35f 
3fff2c60:  3fffb82c 3fffba6c 00000081 4022ffc1 
fff2c70:  3fff2318 00000ff9 00000ff9 4010020c 
3fff2c80:  3fffbdb4 3fffbc8c 00000040 00000000 
fff2c90:  0000000c 3fffb7b4 00000041 00000041 
3fff2ca0:  00000000 00000001 00000001 0000007f 
fff2cb0:  3fffba6c 00000081 3fffba6c 4020db94 
3fff2cc0:  3fffb82c 3fffb7b4 3fffaffc 0000007f 
fff2cd0:  3fffba6c 3fffb7b4 3fffb7b4 4023027d 
3fff2ce0:  00000002 00000001 3fffb7b4 4022f3c4 
fff2cf0:  00000100 00000100 3fffb6ac 3fffb7fc 
3fff2d00:  3fffaf80 00000100 3fffb7b4 402312e8 
fff2d10:  3fffb6ac 3fff3da4 00000003 40234f98 
3fff2d20:  3fff30f4 00000028 00000003 00000000 
3fff2d30:  00000100 3fff8701 3fff30f4 40235496 
3fff2d40:  3fff3da4 3fffb6ac 3fff30f4 40235328 
3fff2d50:  3fffaf54 00000028 3fff30f4 402351c0 
3fff2d60:  000003c0 3fffa2c4 3fff8701 00000000 
3fff2d70:  00000004 3fffaf54 3fff8701 4022e194 
3fff2d80:  00000000 00000000 f9ff37f0 2e632cb7 
3fff2d90:  387025c0 7e57908a 3d371b7c 95d8cdd0 
3fff2da0:  390de231 ed943a12 00000000 00000000 
3fff2db0:  00000000 00000000 00000000 00000000 
fff2dc0:  00000000 00000000 00000000 00000000 
3fff2dd0:  00000000 00000000 00000000 00000000 
fff2de0:  00000000 e01d0000 2d9c00c9 b275b277 
3fff2df0:  4000b6c4 3fff2e30 3fff2fc0 ffffffff 
fff2e00:  4000b72e 3fff2e10 00000008 261eabc9 
3fff2e10:  00000000 00000000 4000a333 3fff2f38 
fff2e20:  3fff2fc0 3fff2f18 3fff481c a3f0a03e 
3fff2e30:  00000000 00000000 00000000 00000000 
fff2e40:  00000000 00000000 00000000 00000000 
3fff2e50:  00000000 00000000 00000000 00000000 
fff2e60:  00000000 00000000 00000000 00000000 
3fff2e70:  00000000 00000000 00000000 00000000 
3fff2e80:  00000000 00000000 00000000 3fff2f10 
3fff2e90:  4000ba18 3fff2f10 00000003 00000020 
3fff2ea0:  00000005 00000000 00000020 4010164a 
3fff2eb0:  3ffeb9a5 40104927 3ffef3e0 00000000 
3fff2ec0:  4010235d 3ffef3e0 00000000 00000000 
3fff2ed0:  0000000f 014f91c6 3ffefe4c 401024ec 
3fff2ee0:  3ffec22c 00000000 00000000 109e48e3 
fff2ef0:  00000000 014f91c6 4010292a 00000100 
3fff2f00:  7fffffff 3ffec22c 3ffec22c 00000001 
fff2f10:  00000001 3fff2fc0 3fff3020 3fff2f90 
3fff2f20:  6c7a5e97 014f91c6 00002200 4000050c 
fff2f30:  3fffc278 401026c4 3fffc200 00000022 
3fff2f40:  3ffec250 5c5c5c5c 5c5c5c5c 5c5c5c5c 
fff2f50:  402316b7 00000030 0000001b ffffffff 
3fff2f60:  4023183c 064491e3 6799a6fa eaa52231 
fff2f70:  82e75e5e 3fff306c 3251aa1c eaa52231 
3fff2f80:  80a65442 54a4463d ffc5c608 ffffffff 
3fff2f90:  3fff30a0 5a827999 3fff3050 00000030 
3fff2fa0:  3fff3080 3fff3020 402148b3 00000001 
3fff2fb0:  ffffffff 00000000 3ffebaf1 00000008 
3fff2fc0:  40214906 3ffef0e8 3fff3dac 00000001 
3fff2fd0:  40214a12 3ffef0e8 3fff3dac 3ffef0e8 
3fff2fe0:  00000008 00000000 00000020 4010164a 
3fff2ff0:  3ffeb9a8 401012f5 00000002 3fff455f 
3fff3000:  00000005 00000008 401011aa 00000002 
3fff3010:  00000002 40100fab 00000002 3ffefaf0 
3fff3020:  00000001 00000000 00000020 4010164a 
3fff3030:  4010490c 3ffef0e8 3ffefaf0 40107084 
3fff3040:  00000001 40103b1b 3ffefb68 401024ec 
3fff3050:  27ac9369 faf25207 bb2627ce faccbe4e 
fff3060:  f9c319b8 00000000 00000000 00000000 
3fff3070:  00000000 00000000 00000000 00000000 
fff3080:  00000000 00000000 00000000 00000000 
3fff3090:  00000000 00000000 00000000 00000000 
fff30a0:  00000000 00000000 00000000 c7260000 
3fff30b0:  f037fff9 b72c632e c0257038 8a90577e 
fff30c0:  7c1b373d d0cdd895 31e20d39 123a94ed 
3fff30d0:  858e023e 1e602483 b685911f 59557954 
fff30e0:  91b8438c e5604d19 4b1adc74 f108ba4e 
3fff30f0:  00000481 00000252 0000036d 81e37982 
3fff3100:  3fffa2fc 3fffab24 00000002 00000000 
3fff3110:  3fffa280 00000004 cbeccb1c c9e0dbb0 
3fff3120:  94505eb8 d4be140b 4c70cca1 3fff7ce9 
3fff3130:  3fffa2fc 00000481 00000a18 4022c842 
3fff3140:  00001299 3fff7c2c 000012a0 00820011 
3fff3150:  d20252e8 4271f3b7 95736e89 e203fc47 
3fff3160:  92fc78f7 787ef326 0f23469f 000012a0 
3fff3170:  000012a0 3fff7ce9 3fff7c2c 4022da79 
3fff3180:  0187f7fa 81c3d2d7 b1352ea9 ec6901eb 
3fff3190:  857800ed 8208a4d1 5fc31648 194f270c 
3fff31a0:  8c81ad70 3fff9814 3fff97d4 00001240 
fff31b0:  000012a0 3fff8f6f 00000019 3fff9814 
3fff31c0:  3fff7c2c 3fff7ce9 000012a0 000012a0 
fff31d0:  000012a0 3fff7ce9 3fff7c2c 4022d4f0 
3fff31e0:  00000000 3fff7ce9 3fff7c2c 4022d898 
fff31f0:  3fff7b6c 3fff7b1c 3fff7c2c 4022c226 
3fff3200:  3fff3250 0000000b 00000010 00000000 
3fff3210:  3fff7b1c 00000000 3fff7c2c 01000000 
3fff3220:  3fff3250 3fff1278 3fff7c2c 4022d648 
3fff3230:  4020d470 00000000 3fff2370 00001387 
3fff3240:  00005595 3fff1278 3fff7b9c 4020da31 
fff3250:  000001bb 3fff7a3c 3fff1278 4020ce96 
3fff3260:  c6a79a95 3fff32f0 3fff3314 3fff32f0 
3fff3270:  3ffeb064 3fff1278 3fff1278 4020dbf0 
3fff3280:  3ffea790 c6a79a95 3fff32f0 00000000 
3fff3290:  00000020 3fff32f0 3fff3314 4020bf4b 
3fff32a0:  3ffea790 c6a79a95 3fff32f0 40210cf3 
3fff32b0:  3fff2318 0000079b 3ffea790 c6a79a95 
3fff32c0:  3fffdad0 3fff3360 3fff32f0 40210e2c 
3fff32d0:  3fffdad0 3fff3360 3fff1178 00000000 
3fff32e0:  3fffdad0 3fff3360 3fff1178 4020c059 
3fff32f0:  3fff799c 0000001f 00000017 3fff2364 
3fff3300:  00000010 3fff3360 3fff3360 40210ca4 
3fff3310:  3fff537c 3fff7a24 0000000f 00000000 
fff3320:  3fff79fc 0000001f 00000017 40210d25 
3fff3330:  3fffdad0 3fff21a8 3fff3360 40210e2c 
fff3340:  4020153a 00000064 3fff188c 3fff2364 
3fff3350:  3fffdad0 3fff21a8 3fff188c 4020a81a 
fff3360:  3fff7984 0000000f 00000001 40205d48 
3fff3370:  3fffdad0 00000000 3fff235d 40211524 
fff3380:  feefeffe feefeffe 3fff2370 40100718 
<<<stack<<<


and the decoded error:

Code: Select allException 29: StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores
Decoding 60 results
0x4022f35f: more_comps at /Users/igrokhotkov/e/axtls/e1/crypto/bigint.c line 1072
0x4022ffc1: bi_divide at /Users/igrokhotkov/e/axtls/e1/crypto/bigint.c line 430
0x4010020c: _umm_free at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1287
0x4020db94: ax_port_realloc at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClientSecure.cpp line 605
0x4023027d: bi_set_mod at /Users/igrokhotkov/e/axtls/e1/crypto/bigint.c line 774
0x4022f3c4: trim at /Users/igrokhotkov/e/axtls/e1/crypto/bigint.c line 1197
0x402312e8: RSA_pub_key_new at /Users/igrokhotkov/e/axtls/e1/crypto/rsa.c line 95
0x40234f98: asn1_get_int at /Users/igrokhotkov/e/axtls/e1/ssl/asn1.c line 158
0x40235496: asn1_public_key at /Users/igrokhotkov/e/axtls/e1/ssl/asn1.c line 461
0x40235328: asn1_get_printable_str at /Users/igrokhotkov/e/axtls/e1/ssl/asn1.c line 375
:  (inlined by) asn1_name at /Users/igrokhotkov/e/axtls/e1/ssl/asn1.c line 407
0x402351c0: asn1_validity at /Users/igrokhotkov/e/axtls/e1/ssl/asn1.c line 315
0x4022e194: x509_new at /Users/igrokhotkov/e/axtls/e1/ssl/x509.c line 114
0x4010164a: pp_post at ?? line ?
0x40104927: lmacRxDone at ?? line ?
0x4010235d: trc_NeedRTS at ?? line ?
0x401024ec: trc_NeedRTS at ?? line ?
0x4010292a: wDev_ProcessFiq at ?? line ?
0x401026c4: wDev_ProcessFiq at ?? line ?
0x402316b7: SHA1ProcessMessageBlock at /Users/igrokhotkov/e/axtls/e1/crypto/sha1.c line 144 (discriminator 2)
0x4023183c: SHA1_Update at /Users/igrokhotkov/e/axtls/e1/crypto/sha1.c line 81
0x402148b3: pp_attach at ?? line ?
0x40214906: pp_attach at ?? line ?
0x40214a12: pp_attach at ?? line ?
0x4010164a: pp_post at ?? line ?
0x401012f5: ppEnqueueRxq at ?? line ?
0x401011aa: ppEnqueueRxq at ?? line ?
0x40100fab: ppProcessTxQ at ?? line ?
0x4010164a: pp_post at ?? line ?
0x4010490c: lmacTxFrame at ?? line ?
0x40107084: pvPortMalloc at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 13
0x40103b1b: lmacRecycleMPDU at ?? line ?
0x401024ec: trc_NeedRTS at ?? line ?
0x4022c842: process_certificate at /Users/igrokhotkov/e/axtls/e1/ssl/tls1.c line 1942
0x4022da79: do_clnt_handshake at /Users/igrokhotkov/e/axtls/e1/ssl/tls1_clnt.c line 93
0x4022d4f0: do_handshake at /Users/igrokhotkov/e/axtls/e1/ssl/tls1.c line 1481
:  (inlined by) basic_read at /Users/igrokhotkov/e/axtls/e1/ssl/tls1.c line 1357
0x4022d898: do_client_connect at /Users/igrokhotkov/e/axtls/e1/ssl/tls1_clnt.c line 154
0x4022c226: ssl_new at /Users/igrokhotkov/e/axtls/e1/ssl/tls1.c line 583
0x4022d648: ssl_read at /Users/igrokhotkov/e/axtls/e1/ssl/tls1.c line 265
0x4020d470: WiFiClient::_s_connected(void*, void*, signed char) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x4020da31: SSLContext::connect(ClientContext*, char const*, unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClientSecure.cpp line 517
:  (inlined by) WiFiClientSecure::_connectSSL(char const*) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClientSecure.cpp line 279
0x4020ce96: WiFiClient::connect(IPAddress, unsigned short) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x4020dbf0: WiFiClientSecure::connect(IPAddress, unsigned short) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClientSecure.cpp line 258
0x4020bf4b: TelegramBOT::connectToTelegram(String) at C:\Users\user\AppData\Local\Temp\arduino_build_958640\sketch/u_TelegramBot.cpp line 29
0x40210cf3: String::reserve(unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x40210e2c: String::operator=(String const&) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x4020c059: TelegramBOT::getUpdates(String) at C:\Users\user\AppData\Local\Temp\arduino_build_958640\sketch/u_TelegramBot.cpp line 68
0x40210ca4: String::changeBuffer(unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x40210d25: String::copy(char const*, unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x40210e2c: String::operator=(String const&) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 720
0x4020153a: delay at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring.c line 53
0x4020a81a: loop at D:\SYSTEM\Desktop\ESP\WebConfig/WebConfig.ino line 210
0x40205d48: operator() at D:\SYSTEM\Desktop\ESP\WebConfig/WebConfig.ino line 183
:  (inlined by) _M_invoke at c:\users\mehdi\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional line 2071
0x40211524: loop_wrapper at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/cont.S line 109