<commit_before>#pragma once

#include "NetUtils.h"
#include "SocketDefs.h"

#include <vector>

// Generic Socket Interface
class ISocket
{
protected:
	SocketDescription Description;

	// Client
	IP4EndPoint ConnectionEndPoint;
	// Server
	std::vector<IP4EndPoint> ConnectedClients;

	// Server: If the socket is bound to a local address and port.
	bool IsBound;

public:
	ISocket() {}
	virtual ~ISocket() {}

	virtual bool Initialize(const SocketDescription& InDescription) = 0;
	virtual void Shutdown() = 0;

	virtual bool Connect(const IP4EndPoint& EndPoint) = 0;

	// Client/Server: Terminate all connections and stop listening.
	virtual bool Close() = 0;

	// Server: Bind to a local address and port number for listening.
	virtual bool Bind(const IP4EndPoint& LocalEndPoint) = 0;

	virtual bool Listen(int MaxBacklog) = 0;

	virtual bool HasPendingConnection() = 0;

	virtual bool AcceptConnection(IP4EndPoint* ClientEndPoint) = 0;

	// Client/Server: Transmit a buffer to a specific client or server.
	virtual bool Send(const IP4EndPoint& Destination, const unsigned char* Data, unsigned int Length, unsigned int& BytesSent) = 0;
	// Server: Transmit a buffer to all connected clients.
	virtual bool Broadcast(const unsigned char* Data, unsigned int Length, unsigned int& BytesSent) = 0;
	// Client/Server: Copy the socket's internal receiving buffer into Data.
	virtual bool Receive(unsigned char* Data, unsigned int MaxReceivingBytes, unsigned int& BytesReceived) = 0;

	SocketDescription GetDescription() const
	{
		return Description;
	}

	IP4EndPoint GetConnectionEndPoint() const
	{
		return ConnectionEndPoint;
	}

	std::vector<IP4EndPoint> GetConnectedClients() const
	{
		return ConnectedClients;
	}

	bool GetIsBound() const
	{
		return IsBound;
	}
};<commit_msg>Removed Copy Ctor and Copy Assignment<commit_after>#pragma once

#include "NetUtils.h"
#include "SocketDefs.h"

#include <vector>

// Generic Socket Interface
class ISocket
{
protected:
	SocketDescription Description;

	// Client
	IP4EndPoint ConnectionEndPoint;
	// Server
	std::vector<IP4EndPoint> ConnectedClients;

	// Server: If the socket is bound to a local address and port.
	bool IsBound;

public:
	ISocket() {}
	virtual ~ISocket() {}

	virtual bool Initialize(const SocketDescription& InDescription) = 0;
	virtual void Shutdown() = 0;

	virtual bool Connect(const IP4EndPoint& EndPoint) = 0;

	// Client/Server: Terminate all connections and stop listening.
	virtual bool Close() = 0;

	// Server: Bind to a local address and port number for listening.
	virtual bool Bind(const IP4EndPoint& LocalEndPoint) = 0;

	virtual bool Listen(int MaxBacklog) = 0;

	virtual bool HasPendingConnection() = 0;

	virtual bool AcceptConnection(IP4EndPoint* ClientEndPoint) = 0;

	// Client/Server: Transmit a buffer to a specific client or server.
	virtual bool Send(const IP4EndPoint& Destination, const unsigned char* Data, unsigned int Length, unsigned int& BytesSent) = 0;
	// Server: Transmit a buffer to all connected clients.
	virtual bool Broadcast(const unsigned char* Data, unsigned int Length, unsigned int& BytesSent) = 0;
	// Client/Server: Copy the socket's internal receiving buffer into Data.
	virtual bool Receive(unsigned char* Data, unsigned int MaxReceivingBytes, unsigned int& BytesReceived) = 0;

	SocketDescription GetDescription() const
	{
		return Description;
	}

	IP4EndPoint GetConnectionEndPoint() const
	{
		return ConnectionEndPoint;
	}

	std::vector<IP4EndPoint> GetConnectedClients() const
	{
		return ConnectedClients;
	}

	bool GetIsBound() const
	{
		return IsBound;
	}

private:
	ISocket(const ISocket& Target);
	ISocket& operator=(const ISocket& Target);
};
{'fraction_non_alphanumeric': 0.08532423208191127, 'fraction_numerical': 0.009976371751115778, 'mean_word_length': 3.9161290322580644, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5482563', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1094, 'n_words': 385}