I want to setup an ESP32 as a TCP/IP server (not a web server). I need it to respond to request for data and send sensor data. All I can find are examples of web servers. Want a TCP/IP server because I already have the client code going and I want to learn. Can someone point me to where I can read and learn as well as examples.
Please note a "web server" is a "TCP server". It's just a specific one (i.e. on a specific TCP port, 80 for http, and a specific data exchange format, http) built on top of TCP/IP.
Said that, let me also say you can find a lot of sources about generic TCP connections with ESP, just google "esp8266 tcp server" to find articles like THIS or THIS.
If you have TCP communication specifications for that sensors (which?), you can implement a proper client or server.
in TCP the server is there to listen for new connections to create a server side socket. but there is no difference between client side and server side socket.
then there is "server" at application level. HTTP server, FTP server, telnet server, MODBUS TCP server... here it is a server responding to some application protocol and serving data or services
i've been working on a multi-node model RR signaling system and was considering programming a list of IP addresses into each node that it needs to share information with.
each node would need to maintain a connection to each other node and would send a msg to each node to report status changes.
i believe this is an example of peer-to-peer instead of client-server model
(i've abandoned this approach and am working on using UDP broadcast. is that even peer-to-peer)
I actually have two projects. One is simple. Going to connect a rain bird rain sensor to one esp32. The esp32's connected to the other sprinkler controllers would pole the "master" for rain status. If we have gotten enough rain the controllers would not come on. In this case I am thinking the master will be the server and all the other's clients. They would ping the master for rain status Or, use UDP and have the master broadcast the rain status.
The second is to send sensor data from my greenhouse, geothermal system and a wx station to a master system. The master will eventually be a python program running on a pi. Right now the PI side is being played by a matlab script (don't know python yet) once I get all the other systems (green house, etc) working I will switch to the pi and learn python. For this one I am thinking all the various systems will be servers and the master will ping each one for its data.
I want to get the ESP32 side of these two projects working first before I tackle python.
for simple peer to peer communications between ESP32s consider using ESP-NOW
one of the ESP32s could then use WiFi to connect to a Python server on the RPi