<commit_before>/*
 * kbiffimap.cpp -- Implementation of class KBiffImap.
 * Author: <NAME> (<EMAIL>)
 * Version: $Id$
 */

#include "utils.h"
#include "kbiffimap.h"

#include <qregexp.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>

KBiffSocket::KBiffSocket()
	: _messages( -1 )
{
}

KBiffSocket::~KBiffSocket()
{
	close();
}

void KBiffSocket::close()
{
	::close(_socket);
}

bool KBiffSocket::connect(const QString & _host, unsigned int port)
{
	// test for _host == ""
	if (_host.isNull()) return false;
	 
	QCString host(_host.ascii());
	sockaddr_in  sin;
	hostent     *hent; 
	int addr;


	// get the socket
	_socket = ::socket( AF_INET, SOCK_STREAM, IPPROTO_IP );

	// start setting up the socket info
	memset( ( char * )&sin, 0, sizeof( sin ) );
	sin.sin_family = AF_INET;
	sin.sin_port   = htons( port );

	// get the address
	if( ( addr = inet_addr( host ) ) == -1 )
	{
		// get the address by host name<commit_msg>modify comment to not show up in automated test scripts<commit_after>/*
 * kbiffimap.cpp -- Implementation of class KBiffImap.
 * Author: <NAME> (<EMAIL>)
 * Version: $Id$
 */

#include "utils.h"
#include "kbiffimap.h"

#include <qregexp.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>

KBiffSocket::KBiffSocket()
	: _messages( -1 )
{
}

KBiffSocket::~KBiffSocket()
{
	close();
}

void KBiffSocket::close()
{
	::close(_socket);
}

bool KBiffSocket::connect(const QString & _host, unsigned int port)
{
	// test to see if _host is empty
	if (_host.isNull()) return false;
	 
	QCString host(_host.ascii());
	sockaddr_in  sin;
	hostent     *hent; 
	int addr;


	// get the socket
	_socket = ::socket( AF_INET, SOCK_STREAM, IPPROTO_IP );

	// start setting up the socket info
	memset( ( char * )&sin, 0, sizeof( sin ) );
	sin.sin_family = AF_INET;
	sin.sin_port   = htons( port );

	// get the address
	if( ( addr = inet_addr( host ) ) == -1 )
	{
		// get the address by host name
{'fraction_non_alphanumeric': 0.16177178623013963, 'fraction_numerical': 0.002888781896966779, 'mean_word_length': 3.68018018018018, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '305936', 'n_tokens_mistral': 845, 'n_tokens_neox': 808, 'n_words': 208}