<commit_before>'use strict';

const net = require('net');

const client = net.connect(3000);

client.on('connect', function () {
    client.write('New client connected...');
});

client.on('data', function (message) {
    console.log(message.toString());
});

process.stdin.on('readable', function () {
    let message = process.stdin.read();
    if (!message) return;
    message = message.toString().trim();
    client.write(message);
});<commit_msg>Add connection/end event handler to the client.<commit_after>'use strict';

const net = require('net');

const client = net.connect(3000);

client.on('connect', function () {
    client.write('New client connected...');
});

client.on('data', function (message) {
    console.log(message.toString());
});

client.on('end', function () {
    console.log('Connection closed.');
    process.exit();
});

process.stdin.on('readable', function () {
    let message = process.stdin.read();
    if (!message) return;
    message = message.toString().trim();
    client.write(message);
});
{'fraction_non_alphanumeric': 0.19554695062923524, 'fraction_numerical': 0.007744433688286544, 'mean_word_length': 4.222222222222222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3251679', 'n_tokens_mistral': 313, 'n_tokens_neox': 305, 'n_words': 67}