I beg your pardon, but my English is not good too. I want to make a server Esp32 that displays results from clients. 2 clients send temperature and humidity.I have a problem in recognizing which customer sends data and whether it is tempeartura or humidity. The server is based on tcp. I am looking for help in how to recognize customer and data. Client send: Tem(1)=21 Hum(1)=60
include
#include <LiquidCrystal_I2C.h>
// set the LCD number of columns and rows
int lcdColumns = 16;
int lcdRows = 2;
// set LCD address, number of columns and rows
// if you don't know your display address, run an I2C scanner sketch
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);
const char* ssid = "xxxx";
const char* password = "xxx";
WiFiServer wifiServer(8088);
void setup() {
lcd.init();
// turn on LCD backlight
lcd.backlight();
Serial.begin(115200);
delay(1000);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
Serial.println(WiFi.localIP());
wifiServer.begin();
}
void loop() {
WiFiClient client = wifiServer.available();
if (client) {
while (client.connected()) {
while (client.available()>0) {
lcd.setCursor(0, 0);
String Message = client.readStringUntil('\n');
Serial.println(Message);
lcd.println(Message);
delay(1000);
lcd.clear();
}
delay(10);
}
client.stop();
Serial.println("Client disconnected");