<commit_before>package com.neverwinterdp.netty.multicast;


import io.netty.util.CharsetUtil;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

/**
 * Super simple UDP Client to send UDP packets to a server and return the response
 * 
 * Example usage:
 *
 * UDPClient x = new UDPClient("localhost",1111);
 * //Sends UDP packet "Hi UDP Server!" and prints out the string of what gets returned from Server 
 * System.out.println("Received: "+x.sendMessage("Hi UDP Server!"));
 * 
 * @author <NAME>
 */
public final class UDPClient {

    private int port;
    private String host;
    
    public UDPClient(String Host, int Port){
    	this.host = Host;
    	this.port = Port;
    }
    
    /**
     * Send a message via UDP.  Sets responseSize to automagic 1024
     * @param message The message to send over the wire
     * @return String response from server
     * @throws InterruptedException
     */
    public String sendMessage(String message) throws InterruptedException{
    	return this.sendMessage(message,1024);
    }
    
    /**
     * Send a message via UDP
     * @param message The message to send over the wire
     * @param responseSize The size of the byte[] to store the response
     * @return String response from server
     * @throws InterruptedException
     */
	public String sendMessage(String message,int responseSize) throws InterruptedException{
    	String retVal=null;
    	try {
    		byte[] msg = message.getBytes( CharsetUtil.UTF_8);
    		// Get the internet address of the specified host
    		InetAddress address = InetAddress.getByName(this.host);

    		// Initialize a datagram packet with data and address
    		DatagramPacket sendPacket = new DatagramPacket(msg, msg.length, address, port);

    		// Create a datagram socket, send the packet through it
    		DatagramSocket dsocket = new DatagramSocket();
    		dsocket.send(sendPacket);
    		
    		//If we can't allocate memory for the response
    		//Then just return
    		if(responseSize < 1){
    			dsocket.close();
    			return "";
    		}
    		
    		//Get response
    		byte[] buf = new byte[responseSize];
    		DatagramPacket receivePacket = new DatagramPacket(buf, buf.length);
    		dsocket.receive(receivePacket);
    		
    		retVal = new String(receivePacket.getData(), 0, receivePacket.getLength());
    		
    		dsocket.close();
    	} 
    	catch (Exception e) {
    		System.err.println(e);
    	}
    	return retVal;
    }
    
    public static void main(String[] args) throws Exception {
    	UDPClient x = new UDPClient("localhost",1111);
    	System.out.println("Received: "+x.sendMessage("Hi UDP Server!"));
    }
}
<commit_msg>Removing main method<commit_after>package com.neverwinterdp.netty.multicast;


import io.netty.util.CharsetUtil;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

/**
 * Super simple UDP Client to send UDP packets to a server and return the response
 * Currently just being used for testing
 * 
 * Example usage:
 *
 * UDPClient x = new UDPClient("localhost",1111);
 * //Sends UDP packet "Hi UDP Server!" and prints out the string of what gets returned from Server 
 * System.out.println("Received: "+x.sendMessage("Hi UDP Server!"));
 * 
 * @author <NAME>
 */
public final class UDPClient {

    private int port;
    private String host;
    
    public UDPClient(String Host, int Port){
    	this.host = Host;
    	this.port = Port;
    }
    
    /**
     * Send a message via UDP.  Sets responseSize to automagic 1024
     * @param message The message to send over the wire
     * @return String response from server
     * @throws InterruptedException
     */
    public String sendMessage(String message) throws InterruptedException{
    	return this.sendMessage(message,1024);
    }
    
    /**
     * Send a message via UDP
     * @param message The message to send over the wire
     * @param responseSize The size of the byte[] to store the response
     * @return String response from server
     * @throws InterruptedException
     */
	public String sendMessage(String message,int responseSize) throws InterruptedException{
    	String retVal=null;
    	try {
    		byte[] msg = message.getBytes( CharsetUtil.UTF_8);
    		// Get the internet address of the specified host
    		InetAddress address = InetAddress.getByName(this.host);

    		// Initialize a datagram packet with data and address
    		DatagramPacket sendPacket = new DatagramPacket(msg, msg.length, address, port);

    		// Create a datagram socket, send the packet through it
    		DatagramSocket dsocket = new DatagramSocket();
    		dsocket.send(sendPacket);
    		
    		//If we can't allocate memory for the response
    		//Then just return
    		if(responseSize < 1){
    			dsocket.close();
    			return "";
    		}
    		
    		//Get response
    		byte[] buf = new byte[responseSize];
    		DatagramPacket receivePacket = new DatagramPacket(buf, buf.length);
    		dsocket.receive(receivePacket);
    		
    		retVal = new String(receivePacket.getData(), 0, receivePacket.getLength());
    		
    		dsocket.close();
    	} 
    	catch (Exception e) {
    		System.err.println(e);
    	}
    	return retVal;
    }

}

{'fraction_non_alphanumeric': 0.091151284490961, 'fraction_numerical': 0.006470028544243577, 'mean_word_length': 2.7976878612716765, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6203317', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1537, 'n_words': 487}