I'm trying to write a TCP server program for the ESP8266 and I'm following the ESP8266 RTOS SDK 1.4.0 Programming Guide to do so. The Guide offers several snippets of code which, regarding simple TCP sockets, appear to be quite similar to the way TCP sockets are created/used in standard C.
However, I'm having trouble finding the correct include files to declare in my program.
Take this snippet, for example:
struct sockaddr_in server_addr;
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = INADDR_ANY;
server_addr.sin_port = htons(26000);
server_addr.sin_len = sizeof(server_addr);
In this case, declarations regarding the 'server_addr' structure and the 'AF_INET' / 'INADDR_ANY' are missing.
I've searched through the available include files and the one that seemed most appropriate was 'lwip/sockets.h'.
However, I noticed the following line on the top of the include file:
#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */
LWIP_SOCKET is defined as 0 and as a result, pretty much nothing gets included. I've also noticed this in a lot of different include files, so I'm guessing simply re-defining 'LWIP_SOCKET' isn't really a smart idea.
Should I include other files instead?
My apologies in advance if this isn't the place for such questions. I'm still a newbie with the ESP8266!
Thanks in advance.