I am connecting one ESP32 and a few ESP8266 boards in a WiFi network, and I need bidirectional communication between the 32 and each of the 8266's.
I can find several examples on creating a client on the 32, and servers on the 8266's. I have only tried one pair so far, but it seems straight forward.
As I understand it, the client can only send data to the server.
However, I require the reverse as well. I need to send data from the client to the server, AND get a response back from the server. (I need to set a relay, and verify the relay got set before moving on to the next steps of the program.)
Must I set up a client and a server on both boards using different ports, or is there something I am missing to get a response from the server back to the client?
At one point the "client = server.available();" on the server side would only return a client instance when the server received data from the client. That meant that the client had to be the first to send. After that, both sides can send in any order for as long as the TCP connection is open.
I had not thought of making a "web server" on the server end and using the "get" mechanism, but I was hoping for a more simple approach. Thanks for the new link, I will keep it in my bookmarks as a reminder for future stuff.
I did not know this, it is exactly what I was looking for. Thanks.
One of the issues I have been having is the usage of the word "client". In most examples, on the client side, you make an instance called "client" with WiFiClient. Then I think you do the same on the server side, and most people call those instances the same thing. Then reading through it is very easy (for me) to get them mixed up.
Of course one can call those things anything one likes, but I find it confusing.