<commit_before>// This #include statement was automatically added by the Spark IDE.
#include "mdns/mdns.h"

#define LISTEN_PORT 7

TCPServer echoServer(LISTEN_PORT);
MDNSResponder mdns;

char szIP[64];
bool isStarted;
char szHTML[] = "<html><body><p>Spark Core and MDNS Working :)</p></body></html>";

TCPServer server = TCPServer(80);

void setup() {
    // Retrieve and convert to integer format
    IPAddress addr = Network.localIP();
    uint32_t ip = (addr[0] * 16777216) + (addr[1] * 65536) + (addr[2] * 256) + (addr[3]);
    
    // Begin MDNS
    isStarted = mdns.begin("myspark", ip);
    
    // If started, set the variable to IP address of the Spark Core
    // else set error message
    if(isStarted){
        sprintf(szIP, "%d.%d.%d.%d (%u)", addr[0], addr[1], addr[2], addr[3], ip);
         server.begin();
    }
    else{
        sprintf(szIP, "Error starting MDNS.");
    }
    
    Spark.variable("mdnsstatus", szIP, STRING);
}

void loop() {
    // If we started successfully, then wait for the client to connect
    // else do nothing
    if(isStarted){
        TCPClient client = server.available();
        if (client){
            client.write(szHTML);
            client.flush();
            client.stop();
        }
    }
    
    delay(2000);
}<commit_msg>Example application updated<commit_after>// This #include statement was automatically added by the Spark IDE.
#include "mdns/mdns.h"

#define LISTEN_PORT 7

TCPServer echoServer(LISTEN_PORT);
MDNSResponder mdns;

char szIP[64];
bool isStarted;
char szHTML[] = "<html><body><p>Spark Core and MDNS Working :)</p></body></html>";

TCPServer server = TCPServer(80);

void setup() {
    // Retrieve and convert to integer format
    IPAddress addr = Network.localIP();
    uint32_t ip = (addr[0] * 16777216) + (addr[1] * 65536) + (addr[2] * 256) + (addr[3]);
    
    // Begin MDNS
    isStarted = mdns.begin("myspark", ip);
    
    // If started, set the variable to IP address of the Spark Core
    // else set error message
    if(isStarted){
        sprintf(szIP, "%d.%d.%d.%d (%u)", addr[0], addr[1], addr[2], addr[3], ip);
         server.begin();
    }
    else{
        sprintf(szIP, "Error starting MDNS.");
    }
    
    Spark.variable("mdnsstatus", szIP, STRING);
}

void loop() {
    // If we started successfully, then wait for the client to connect
    // else do nothing
    if(isStarted){
        mdns.update();
        
        TCPClient client = server.available();
        if (client){
            client.write(szHTML);
            client.flush();
            client.stop();
        }
    }
    
    delay(2000);
}
{'fraction_non_alphanumeric': 0.14613618974751338, 'fraction_numerical': 0.026778882938026015, 'mean_word_length': 2.5626702997275204, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1651973', 'n_tokens_mistral': 900, 'n_tokens_neox': 856, 'n_words': 243}