lwIP Socket API difference between WIFI & ETH Stack.

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

lwIP Socket API difference between WIFI & ETH Stack.

Postby Gfast2 » Thu Mar 22, 2018 2:44 pm

Hallo ESP-IDF,

pretty sure I should investigate long enough time before I post these questions in the forum. But your suggestion sometimes only take like 30sec. from your time (even the time for relax like me sometimes :lol: ) But it has the potential to save me many days to scratching my face and hair :lol:

I have a library (open62541) call Socket API of lwIP to make the tcp communications. It works just fine in a Project with WIFI, but the very same library (all toolchain and esp-idf are with the same version & git commit) won't work on the other project with ethernet. Here is where it get stucked:

Code: Select all

35836     if(setsockopt(newsock, SOL_SOCKET, SO_REUSEADDR,
35837                   (const char *)&optval, sizeof(optval)) == -1) {
35838         UA_LOG_WARNING(UA_Log_Stdout, UA_LOGCATEGORY_NETWORK,
35839                        "Could not make the socket reusable");
35840         CLOSESOCKET(newsock);
35841         return;
35842     }
Any idea for this?

Cheers

Gfast

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: lwIP Socket API difference between WIFI & ETH Stack.

Postby Gfast2 » Thu Mar 22, 2018 2:48 pm

Here is the newsock:

Code: Select all

35810     /* Create the server socket */
35811     SOCKET newsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
Here is the optval:

Code: Select all

35826     int optval = 1;

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

Re: lwIP Socket API difference between WIFI & ETH Stack.

Postby kolban » Fri Mar 23, 2018 9:21 pm

What is the value of errno from the setsockopt() call? I also seem to remember that there was a setting in make menuconfig that governed whether or not SO_REUSEADDR was enabled. Could it be set to one value in the working project and a different value in your failing project?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 99 guests