-->
Page 1 of 1

ESP8266 server question

PostPosted: Wed Sep 29, 2021 10:56 am
by RRnoa
Hello,
i have set a tcp-server on esp8266. I connect to esp8266 wifi and when I type the esp8266 ap id..my webpage load but without my photo-backround because esp8266 has no internet access. I read that is how supposed to be.But when I connect to the same network which esp8266 is connected and type the sta id of esp8266 my page load properly because i have internet access.I don't see any difference in both cases but when i build an esp-server i sould connect to ap id and why?
Thank you,i am first time dealing with esp8266 and IoT

Re: ESP8266 server question

PostPosted: Wed Sep 29, 2021 3:49 pm
by quackmore
as you have been noticed, the http server on the esp8266 (or web server if you prefer) works whether the esp is in AP or STATION mode
but it can only serve up local resources (resources that are on the esp) to your browser
while the web page can contain references to resources that are local (on the esp) or on the internet (e.g. an image with a src attribute pointing to some internet url)

when you connect a device to an esp working as AP, the device doesn't have internet access and the browser on that device won't be able to load internet resources

when you connect a device to an esp working as STATION (connected to your wifi, which is connected to the internet), the device still has internet access and the browser on that device will be able to load internet resources

that's it


long story short:
1) you don't have to force the esp into AP mode to use it as an http server
2) if you want to use the esp in AP mode, you have to move all the resources referenced by the web page onto the esp

Re: ESP8266 server question

PostPosted: Mon Oct 04, 2021 10:51 am
by RRnoa
Thank you, i just confused cause many examples on the internet relative to <esp8266 as web server> connect to ap ip and I thought maybe connecting to sta IP was a problem.