<commit_before>#include <ESP8266WiFi.h>
#include <ESP8266Client.h>

//------------------------------------------
//const char* ssid     = "wl-fmat-ccei-b";
//const char* password = "";
const char* ssid     = "Cablemas0F0D";
const char* password = "<PASSWORD>";

// create a TCP client
ESP8266Client client("192.168.0.11", 9999);
//ESP8266Client client("172.16.69.82", 2000);

//variable para almacenar lo que enviaremos al servidor
 String cadena = " "; 

unsigned long now = 0;

//------------------------------------------
// CB forward declarations
void onDataCb(ESP8266Client& client, char *data, unsigned short length);
void onConnectCb(ESP8266Client& client);
void onDisconnectCb();
void onReconnectCb(ESP8266Client& client, sint8 err);


//------------------------------------------
void setup() {
  Serial.begin(115200);
  delay(10);

  // 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());

  // set callback functions
  client.onData(onDataCb);
  client.onConnected(onConnectCb);
  client.onDisconnected(onDisconnectCb);
  client.onReconnect(onReconnectCb);
}

void loop() {

        // leectura datos recibidos por serial
        if (Serial.available() > 0) {
                // read the incoming string
                cadena = Serial.readString();
  if (client.isConnected()) {
    //Serial.println("sending to server");
    client.send(cadena.c_str());
  } else {
    // connect
    boolean res = client.connect();
    if (!res) {
//      Serial.println("could not connect");
    }    
  }

  delay(10);
        }
}


//------------------------
//------------------------
// general callbacks
void onDataCb(ESP8266Client& client, char *data, unsigned short length)
{
  Serial.write(data, length);<commit_msg>Modificación serial-server<commit_after>#include <ESP8266WiFi.h>
#include <ESP8266Client.h>

//------------------------------------------
//const char* ssid     = "wl-fmat-ccei-b";
//const char* password = "";
const char* ssid     = "Cablemas0F0D";
const char* password = "<PASSWORD>";

// create a TCP client
ESP8266Client client("192.168.0.11", 9999);
//ESP8266Client client("172.16.69.82", 2000);

//variable para almacenar lo que enviaremos al servidor
 String cadena = " "; 

unsigned long now = 0;

//------------------------------------------
// CB forward declarations
void onDataCb(ESP8266Client& client, char *data, unsigned short length);
void onConnectCb(ESP8266Client& client);
void onDisconnectCb();
void onReconnectCb(ESP8266Client& client, sint8 err);


//------------------------------------------
void setup() {
  Serial.begin(115200);
  delay(10);

  // 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());

  // set callback functions
  client.onData(onDataCb);
  client.onConnected(onConnectCb);
  client.onDisconnected(onDisconnectCb);
  client.onReconnect(onReconnectCb);
}

void loop() {

        // leectura datos recibidos por serial
        if (Serial.available() > 0) {
                // read the incoming string
                cadena = Serial.readString();
  if (client.isConnected()) {
    //Serial.println("sending to server");
    client.send(cadena.c_str());
  } else {
    // connect
    boolean res = client.connect();
    if (!res) {
//      Serial.println("could not connect");
    }    
  }

  delay(10);
        }
}


//------------------------
// general callbacks
void onDataCb(ESP8266Client& client, char *data, unsigned short length)
{
  Serial.write(data, length);
{'fraction_non_alphanumeric': 0.22273166023166024, 'fraction_numerical': 0.03667953667953668, 'mean_word_length': 2.3213141025641026, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2357865', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1308, 'n_words': 292}