Thank's in advance
#include <ESP8266WiFi.h>
const char* ssid = "*******";
const char* password = "********";
const int Port = 23;
const char* host = "192.168.1.30";
String InputString;
// Use WiFiClient class to create TCP connections
WiFiClient client;
void setup() {
Serial.begin(115200);
delay(1000);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
if (!client.connect(host, Port)) {
Serial.println("connection failed");
return;
}
Serial.println("Sending ...");
client.print("TEST DATA TO MLServer\r\n");
delay(10);
// yield();
if (!client.connect(host, Port)) {
Serial.println("connection failed");
return;
}
// Read cmd:s FROM MLServer
//*********************************************************
//Connected to MLServer waiting for incoming data
//How to timeout and exit if no data avaliable ???????
//*********************************************************
while (client.connected()) {
while (client.available()) {
String line = client.readStringUntil('\r');
Serial.println(line);
return;
}
}
delay(3000);
}