<commit_before>package main

import (
	"fmt"
	"io"
	"net"
	"strconv"
)

func Reader(reader io.Reader, messageChannel chan []byte) {
	buf := make([]byte, 1024)
	for {
		n, err := reader.Read(buf[:])
		if err != nil {
			logger.Error("Can't read: %s", err.Error())
			return
		}

		if *debug {
			logger.Debug(fmt.Sprintf("Received from socket:  %s", buf[0:n]))
		}

		select {
		case messageChannel <- buf[0:n]:
		default:
		}
	}
}

func Sender(host string, port int, messageChannel chan []byte) {

	ServerAddress, err := net.ResolveUDPAddr("udp", host + ":" + strconv.Itoa(port))
	if err != nil {
		logger.Error("Can't resolve remote UDP address: %s", err.Error())
		return
	}

	LocalAddress, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
	if err != nil {
		logger.Error("Can't resolve local UDP address: %s", err.Error())
		return
	}

	Conn, err := net.DialUDP("udp", LocalAddress, ServerAddress)
	if err != nil {
		logger.Error("Can't dial up: %s", err.Error())
		return
	}

	defer Conn.Close()

	for {
		select {
		case msg := <-messageChannel:

			if *debug {
				logger.Debug(fmt.Sprintf("Writing to UDP socket:  %s", msg[:]))
			}

			_, err := Conn.Write(msg[:])
			if err != nil {
				logger.Error("Can't write: %s", err.Error())
			}
		}
	}
}

<commit_msg>fixng problem with UDP connection<commit_after>package main

import (
	"fmt"
	"io"
	"net"
	"strconv"
)

func Reader(reader io.Reader, messageChannel chan []byte) {
	buf := make([]byte, 4096)
	for {
		n, err := reader.Read(buf[:])
		if err != nil {
			logger.Error("Can't read: %s", err.Error())
			return
		}

		if *debug {
			logger.Debug(fmt.Sprintf("Received from socket:  %s", buf[0:n]))
		}

		select {
		case messageChannel <- buf[0:n]:
		default:
		}
	}
}

func Sender(host string, port int, messageChannel chan []byte) {

	ServerAddress, err := net.ResolveUDPAddr("udp", host + ":" + strconv.Itoa(port))
	if err != nil {
		logger.Error("Can't resolve remote UDP address: %s", err.Error())
		return
	}

	Conn, err := net.DialUDP("udp", nil, ServerAddress)
	if err != nil {
		logger.Error("Can't dial up: %s", err.Error())
		return
	}

	defer Conn.Close()

	for {
		select {
		case msg := <-messageChannel:

			if *debug {
				logger.Debug(fmt.Sprintf("Writing to UDP socket: %s", msg[:]))
			}

			_, err := Conn.Write(msg[:])
			if err != nil {
				logger.Error("Can't write: %s", err.Error())
			}
		}
	}
}


{'fraction_non_alphanumeric': 0.18246644295302014, 'fraction_numerical': 0.007969798657718121, 'mean_word_length': 3.3128390596745025, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '851912', 'n_tokens_mistral': 1025, 'n_tokens_neox': 891, 'n_words': 223}