jonask1337 / esp-idf-nat-example

ESP-IDF example project with NAT setup.
83 stars 15 forks source link

Source / Update for CMake #4

Closed p-thommo closed 4 years ago

p-thommo commented 5 years ago

Hi jonask1337, We have a project where we wish to create a WiFi Extender using ESP32s. Our environment is created with CMake, and we don't require many of the features available in your work.

Are you aware if anyone has created a CMake version of this "ESP-IDF lwIP library with NAT" project and, if not, would you be interested in doing so [as a commercial venture], on our behalf? Peter

jonask1337 commented 5 years ago

Hi Peter, do you mean that you use the ESP-IDF with CMake as build system? In this case, you should be able to use the "ESP-IDF lwIP library with NAT" project in the same way as with the "old" GNU Make Build system. Jonas

p-thommo commented 5 years ago

Hi Jonas, Thanks for your response. I'll get the guys to give it a go again tomorrow and let you know how it works out. Initial attempts weren't successful.

Using your "ESP-IDF lwIP library with NAT", does this have any affect on the maximum quantity of Sockets that can be simultaneously open, or will that number remain at 16?

jonask1337 commented 5 years ago

You can still open 16 sockets, but with the NAT library, memory usage is likely to be higher, which may affect the amount of sockets that can actually be used simultaneously.

p-thommo commented 5 years ago

Yes - that makes sense. Thanks for confirming this - we were afraid it may do something like half them. Are you aware, with regard to ESP32's various memory divisions, what memory area the NAT Lib is utilizing and relying upon?

p-thommo commented 5 years ago

Jonas, We have succeeded to get the NAT functioning as a WiFi Extender, but ONLY if connected to a Router [eg to the Internet].

In the instance when we try to use it [the WiFi Extender] to connect to another ESP-32 [configured as an AP, and running TCP Server], we are unable to send it data.

In short, it seems we are unable to create a Socket.

Do you have any thoughts on why this may be the case and, have you ever attempted to do this yourself?

p-thommo commented 5 years ago

(1)ESP STA <> (2)ESP AP <> (3)ESP NAT Extender <> (4)Phone App controlling several (1)ESP STA

The above sequence is representative of the path in our design.

It doesn't go outside - so no internet connection/router. Both the (2)AP and (3)NAT Extender are ESP32s, and there are several (1)ESP32 STA connected to the AP.

jonask1337 commented 5 years ago

Did you change the AP IP of either (2) ESP AP or (3)ESP NAT Extender? I think if they both use the default IP (192.168.4.1) it can not work.

I tested this with a similiar setup: (1) ESP AP (AP IP: 192.168.4.1) <> (2) ESP NAT Extender (Station IP: 192.168.4.2, AP IP: 192.168.5.1) <> (3) PC (IP: 192.168.5.2)

With this setup i could connect to the TCP Server on (1) from my PC (3).

p-thommo commented 5 years ago

Hi Jonas, Sorry it took a while to respond. Yes, that finally 'occurred' to us [just the day before your response came through]. We were indeed still using the 'same' default IP on both the NAT and AP. Silly mistake. Thanks again.