Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running web server on both Ap and Station #2299

Open
Matzz opened this issue Apr 3, 2021 · 1 comment
Open

Running web server on both Ap and Station #2299

Matzz opened this issue Apr 3, 2021 · 1 comment

Comments

@Matzz
Copy link
Contributor

Matzz commented Apr 3, 2021

Hi,
I'm trying to bind web server to both station and AP network.
When I run Station and IP without setting an IP and station receive the same IP as AP then web server works on both.

However when I set different IP for station then only AP is accessible. My sample code is here:
https://github.com/Matzz/Sming/blob/StationAndApHttpServer/samples/StationAndApHttpServer/app/application.cpp

I was thinking about a PR to enable correct behavior. My one idea was to replace IP_ADDR_ANY with provided IP in following line:

	err_t res = tcp_bind(tcp, IP_ADDR_ANY, port);

However, it will require running 2 web servers at the same time, which is inefficient.
Another idea is to modify this line to bind to both networks regardless the IP. I saw this working when IP is the same for both Station and IP. However, due to lack of lwIP knowledge, I don't know how to enforce that for different ip.

I'm willing to make a PR for that but I would need some guidance / ideas first.

Regards,
Matzz

@Matzz
Copy link
Contributor Author

Matzz commented Apr 3, 2021

Related post - esp8266/Arduino#2155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant