Page 1 of 1

lwIP Socket API difference between WIFI & ETH Stack.

Posted: Thu Mar 22, 2018 2:44 pm
by Gfast2
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

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

Posted: Thu Mar 22, 2018 2:48 pm
by Gfast2
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;

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

Posted: Fri Mar 23, 2018 9:21 pm
by kolban
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?