esp8266 / esp8266/Arduino

ESP8266WifiServer timeout when requesting through external IP

Open
#8,853 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

I have a basic `ESP8266WebServer` that sends roughly 1000 characters worth of response via `send()`. Everything works fine when the traffic is over the local IPv4 address _192.168.xx.xx_.

However, I have set up port forwarding over my external IP to be directed to the NodeMCU device, and when the request is made over the external IP _87.xx.xx.xx_ via a device connected to the local network, the server times out during `send()` operation. Upon closer inspection, it seems that `ClientContext::availableForWrite()` / `tcp_sndbuf` returns `0` in this case. Increasing the timeout to `10s` didn't help. Seems the buffer is never available.

As an additional step, I set up a VPN on the request device to make the request device's IP as _105.xx.xx.xx_ and made the same request. This time `ClientContext::availableForWrite()` / `tcp_sndbuf` returned a non-zero value and the request was successful.

Any ideas why the `tcp_sndbuf` would not work when a request is made by a device connected on the same network but via external IP that is port forwarded to my NodeMCU?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.