ESP8266 communication and wired network

Hi. I want to make a bidirectional communication between two arudinos. I had thought about using two ESP8266s but I don't know if it is possible with the following scenario.

I have an AP at one end of the wired network and another AP at the other end. The two ESP8266 cannot be seen directly, I should connect one to an AP and the other to the other AP, but I don't know how to configure the ESP8266 or what libraries exactly to, for example, with TCP establish a bidirectional communication between them.

Thank you

I moved your topic to an appropriate forum category @jjuan.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

The AP defines its own network. Two APs are two different networks and can't talk to each other. Either one has to be an AP and the other a station or both stations if they are both connected to the same router.

I clarify. The two ESP8266 would be on the same network at both ends. This is why I am wondering if bidirectional TCP communication is possible if both ESP8266s are configured as clients.

You need a server and a client. Something like this.

If you don't need the LAN connection you could use a peer to peer protocol like ESP-NOW

the ESP8266 can work in Soft AP and Station modes simultaneously - have a look at esp8266-ap-and-station-mode

therefore, an ESP8266 should be able run run an AP and also connect as a station to the other AP

Usually you need one client which initiates the connection and another server which reacts on that incomming connection.

may be this page helps to gain some basic understanding:
https://werner.rothschopf.net/microcontroller/202403_esp_arduino_data_transmission_en.htm

At the end of the page there is also a link to a plain TCP example with a TCP client and a TCP Server.

Have a look at this:

I think it contains everything you need to do what you want.

With regard to the APs, are you making the common mistake of thinking they have to have different SSIDs and passwords? Unless there's a very specific reason for them to be different they should be the same on both / all APs on the network.

That would be a good option. I have to try it, thanks

I agree, but with the LAN in the middle I don't know how to configure it so that it reaches from one end to the other.

Thank you. I'll check out that link, it looks interesting.

1 Like

your network infrastrukture should be transparent to your ESPs.

Connect laptops via wifi on both ends of your network and start testing to get connectivity and ensure that your infrastructure is working.

Thank you so much. I think that among all of us I am clarifying ideas.
Regarding ESP-NOW, I have been researching and it is a good communication option. But I haven't found the libraries.

I have never used it, but I think it is part of the base esp support so you don't need to do anything special other than the include.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.