WiFiClient connection error

gearwalker
Posts: 5
Joined: Thu Dec 08, 2016 1:10 pm

WiFiClient connection error

Postby gearwalker » Thu Dec 08, 2016 1:16 pm

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...

gearwalker
Posts: 5
Joined: Thu Dec 08, 2016 1:10 pm

Re: WiFiClient connection error

Postby gearwalker » Wed Dec 14, 2016 6:37 am

[SOLVED] :-D

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: WiFiClient connection error

Postby kolban » Wed Dec 14, 2016 11:29 pm

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?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

PeWosT
Posts: 10
Joined: Wed Feb 01, 2017 3:59 pm

Re: WiFiClient connection error

Postby PeWosT » Tue Feb 07, 2017 11:52 am

I have the same problem, how can it be solved?

PeWosT
Posts: 10
Joined: Wed Feb 01, 2017 3:59 pm

Re: WiFiClient connection error

Postby PeWosT » Sat Feb 11, 2017 6:52 pm

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

bioyavuz
Posts: 1
Joined: Sun Jan 14, 2018 9:04 pm

Re: WiFiClient connection error

Postby bioyavuz » Sun Jan 14, 2018 9:28 pm

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

AndonProject
Posts: 3
Joined: Wed Dec 06, 2017 9:29 am

Re: WiFiClient connection error

Postby AndonProject » Fri Jan 19, 2018 1:47 pm

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

Who is online

Users browsing this forum: No registered users and 133 guests