Page 1 of 1

WiFiClient connection error

Posted: Thu Dec 08, 2016 1:16 pm
by gearwalker
Hello,

I'm now playing with ESP32 (NANO32). Successfully setup Arduino environment for ESP32.
So, When I trying WiFiClient example. I can connected to my local host for a first time. But when I try to connect it again it always failed and afterward. Below is error what I got.

[E][WiFiClient.cpp] connect(): lwip_connect_r: 113

Can you guide me, where I have to check or what have I done wrong?
Thank you so much...

Re: WiFiClient connection error

Posted: Wed Dec 14, 2016 6:37 am
by gearwalker
[SOLVED] :-D

Re: WiFiClient connection error

Posted: Wed Dec 14, 2016 11:29 pm
by kolban
Congrats on getting it working ... awesome. Might you have a few minutes to post what you did in case someone in the future has the problem and finds this post?

Re: WiFiClient connection error

Posted: Tue Feb 07, 2017 11:52 am
by PeWosT
I have the same problem, how can it be solved?

Re: WiFiClient connection error

Posted: Sat Feb 11, 2017 6:52 pm
by PeWosT
I discovered part of the problem, I was trying to connect to my own server that I have in a raspberry, every 5 times that the esp tried to connect only managed to connect 1 time, on another linux server if it is able to connect every time well.

Anyone know why with the raspberry does not connect well to the server?

thanks in advance

Re: WiFiClient connection error

Posted: Sun Jan 14, 2018 9:28 pm
by bioyavuz
I think I solved this problem with an interesting finding. I had much from Mr.Kolban's book on ESP32 in my first steps. So I think I owe Mr.Kolban to share my finding:

All of a sudden I started having these Error messages:
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:270] _eventCallback(): Reason: 201 - AUTH_FAIL
Sensors count: 2
21.937C,
[E][WiFiClient.cpp:97] connect(): lwip_connect_r: 118
21.812C,
[E][WiFiClient.cpp:97] connect(): lwip_connect_r: 118

[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:270] _eventCallback(): Reason: 201 - AUTH_FAIL
Sensors count: 2


Whatever suggestion I found, I tried but no luck. I copied people's suggested code to solve this problem in a new sketch and faced no problem. But copied the code into my sketch, problem appeared again. Then I started a new sketch totally from begining. It worked without error.

Then I decided to find out the differences between my long sketch and the new one. After spending few sleepless days, here is my finding:

When I start a new sketch from begining, by default is not in debug mode. Howewer in my original sketch it is, to see what is going on.

So, switching "tools->Core Debug Level" to "None" solved my problem. Tested my finding by playing the "Core Debug Level" with all possibilities, proved me that: problem disappears only in "None"

I can neither understand nor explain the relation among them. But this solves my problem. I hope this helps other people, too.

Kindest Regards to Mr. Kolban.
Yavuz Darendelioğlu

Re: WiFiClient connection error

Posted: Fri Jan 19, 2018 1:47 pm
by AndonProject
Hi bioyavuz

Thank you for this suggestion. I had the same issues as gearwalker, but I am still not able to solve it.
I tried your suggestion and it did not work either. I believe, that changing the core debug level to "None" does not affect this issue, because the error will not be sent to the Serial monitor, but it still occurs.

I am really interested in the solution of gearwalker... :)

Cheers