-->
Page 1 of 1

esp8266-01 and server

PostPosted: Tue Mar 02, 2021 4:31 pm
by RRnoa
Hey,i want make a <<beginner>> question.When i set esp8266 as server how can i connect to the server from a different access point?I read about port forwarding but there is no a more simple way?I want to create an application communicate(send-receive data) with the esp01.Which is the right method?
1.APPLICATION->an other SERVER->ESP-01 AS ACCESS POINT
2.APPLICATION->ESP01 AS SERVER
Or something else?
I will appreciate answer me because i am so confused.Thank you :)

Re: esp8266-01 and server

PostPosted: Thu Mar 04, 2021 5:15 am
by QuickFix
You do understand the concept of wireless networking (WiFi)?

An ESP8266 is not different then, for instance, a mobile phone or laptop using WiFi or an access point or router.
You can turn an ESP into a client (requesting data from a server, in STA-mode), a server (responding to requests from others, in AP-mode) or both at once (in STA/SoftAP-mode).

If you want your ESP to be something in a network, you just have to configure it like any other device and use the appropriate software (or "Firmware") to perform this task.
In your case (as you've described) you want the ESP to perform as a server (serving requests from other clients) inside your network, so you have to set things up like any other server (for instance a webserver or FTP-server on a normal PC).

When the correct software is installed (= firmware is flashed), you have to let your server connect to your network (so it will be in STA-mode) and give it an IP address (dynamically using DHCP or statically, doesn't matter, but static is easier to keep track of).
After that, any device within the network can communicate with your ESP-server.

If you want to be able to access your ESP-server from outside your network, you have to forward its port to the outside by adding a port-forward rule inside your modem/router.

As said: the ESP is exactly like any other network device, albeit a little smaller.

As long as you don't confuse being a client/server with STA/AP-mode (they're not the same): :idea:
  • Client: asks data from a server
  • Server: replies to data requests from a client
  • Station: a network device wanting to connect to an access point
  • Access Point: a central device connecting stations that request a connection

Re: esp8266-01 and server

PostPosted: Sat Mar 06, 2021 6:40 pm
by RRnoa
Thank you so much.You helped me a lot(no like other forums which hate beginners :cry: ).My last consider is how *safe is port forwarding.Is esp8266 affect the safety of port forwarding?(i read a lot in the internet and i did not came on a conclusion)
* by safe i mean which is the worst case get hacked

If is not safe,VPN is a better solution?
I make a lot questions,if someone could answer i would appreciate it a lot :) :) .(Is not that i dont google searching but i dont know if something is right and it answers my question exactly)
If you need more information just tell me :)