<commit_before>#pragma once

#include <unistd.h>     // close
#include <sys/socket.h> // socket

#include <string> // std::string

#include "ip.hpp"
#include "sockaddr.hpp"

namespace cpl
{
namespace net
{

class Socket
{
public:
	Socket()
	{
	}

	~Socket() throw()
	{
		if (fd >= 0) {
			close(fd);
		}
	}

	virtual int bind(std::string address, int port) throw() = 0;

protected:
	int fd;
	SockAddr local_address;

private:
	Socket(const Socket&);
	Socket& operator = (const Socket&);
}; // Socket

} // net
} // cpl<commit_msg>add Socket.set_nonblocking()<commit_after>#pragma once

#include <unistd.h>     // close
#include <sys/socket.h> // socket
#include <fcntl.h> // fnctl

#include <string> // std::string

#include "ip.hpp"
#include "sockaddr.hpp"

namespace cpl
{
namespace net
{

class Socket
{
public:
	Socket()
	{
	}

	~Socket() throw()
	{
		if (fd >= 0) {
			close(fd);
		}
	}

	virtual int bind(std::string address, int port) throw() = 0;

	inline void
	set_nonblocking()
	{
		fcntl(fd, F_SETFL, SO_SNDTIMEO);
	}

protected:
	int fd;
	SockAddr local_address;

private:
	Socket(const Socket&);
	Socket& operator = (const Socket&);
}; // Socket

} // net
} // cpl
{'fraction_non_alphanumeric': 0.16652506372132542, 'fraction_numerical': 0.0033984706881903144, 'mean_word_length': 3.411985018726592, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, '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': '1147182', 'n_tokens_mistral': 491, 'n_tokens_neox': 468, 'n_words': 113}