<commit_before>using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace StatsdClient
{
    public interface IStatsdClient
    {
        void Send(string command);
    }

    public class StatsDClient : IDisposable, IStatsdClient
    {
        public IPEndPoint IPEndpoint { get; private set; }

        private readonly int _maxUdpPacketSizeBytes;
        private readonly Socket _clientSocket;
        private readonly string _name;
        private readonly int _port;

        /// <summary>
        /// Creates a new StatsdUDP class for lower level access to statsd.
        /// </summary>
        /// <param name="name">Hostname or IP (v4) address of the statsd server.</param>
        /// <param name="port">Port of the statsd server. Default is 8125.</param>
        /// <param name="maxUdpPacketSizeBytes">Max packet size, in bytes. This is useful to tweak if your MTU size is different than normal. Set to 0 for no limit. Default is MetricsConfig.DefaultStatsdMaxUDPPacketSize.</param>
        /// <param name="useTcpProtocol">Sets the protocol type on Socket.</param>
        public StatsDClient(string name, int port = 8125, int maxUdpPacketSizeBytes = MetricsConfig.DefaultStatsdMaxUDPPacketSize, bool useTcpProtocol = false)
        {
            _name = name;
            _port = port;
            _maxUdpPacketSizeBytes = maxUdpPacketSizeBytes;

            if (useTcpProtocol)
            {   _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Tcp);    }
            else
            {   _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);    }

            var ipAddress = GetIpv4Address(name);
            IPEndpoint = new IPEndPoint(ipAddress, _port);
        }
<commit_msg>Change SocketType to Stream for Tcp protocol<commit_after>using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace StatsdClient
{
    public interface IStatsdClient
    {
        void Send(string command);
    }

    public class StatsDClient : IDisposable, IStatsdClient
    {
        public IPEndPoint IPEndpoint { get; private set; }

        private readonly int _maxUdpPacketSizeBytes;
        private readonly Socket _clientSocket;
        private readonly string _name;
        private readonly int _port;

        /// <summary>
        /// Creates a new StatsdUDP class for lower level access to statsd.
        /// </summary>
        /// <param name="name">Hostname or IP (v4) address of the statsd server.</param>
        /// <param name="port">Port of the statsd server. Default is 8125.</param>
        /// <param name="maxUdpPacketSizeBytes">Max packet size, in bytes. This is useful to tweak if your MTU size is different than normal. Set to 0 for no limit. Default is MetricsConfig.DefaultStatsdMaxUDPPacketSize.</param>
        /// <param name="useTcpProtocol">Sets the protocol type on Socket.</param>
        public StatsDClient(string name, int port = 8125, int maxUdpPacketSizeBytes = MetricsConfig.DefaultStatsdMaxUDPPacketSize, bool useTcpProtocol = false)
        {
            _name = name;
            _port = port;
            _maxUdpPacketSizeBytes = maxUdpPacketSizeBytes;

            if (useTcpProtocol)
            {   _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);    }
            else
            {   _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);    }

            var ipAddress = GetIpv4Address(name);
            IPEndpoint = new IPEndPoint(ipAddress, _port);
        }

{'fraction_non_alphanumeric': 0.0824235807860262, 'fraction_numerical': 0.006004366812227074, 'mean_word_length': 2.6395233366434954, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '4866450', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1006, 'n_words': 306}