#include "ASocketConnector.h"


	// ASocketConnector
	
ASocketConnector::ASocketConnector():
timeout(0),
random_seed(0),
current(0),
max_priority(0), 
min_priority(0), 
adjust(false),
bind_port(0),
bound(false)
{}

int ASocketConnector::bind_to_card(unsigned card_number, unsigned short port)
{  int g=0;

	char buf[10001];

	AFunctionLock lock(mutex);

	g=IP_host(buf,1000,bind_address,card_number);
	if(g) return 1;

	bind_port=port;
	
	bound=true;
	
	return 0; 
}

int ASocketConnector::add(const char * address,const char * port, int priority)
{ int g=0;

	AFunctionLock lock(mutex);

	return 0;
}

int ASocketConnector::add(const IPAddress& address,const char * port, int priority)
{ int g=0;

	AFunctionLock lock(mutex);


	return 0;
}

int ASocketConnector::add(const IPAddress& address,unsigned port, int priority)
{ int g=0;

	AFunctionLock lock(mutex);


	return 0;
}

int ASocketConnector::add(const IPSocketAddress& address_port, int priority)
{ int g=0;

	AFunctionLock lock(mutex);


	return 0;
}

int ASocketConnector::add_name(const char * name,const char * port, int priority, unsigned name_size_limit)
{ int g=0;

	AFunctionLock lock(mutex);


	return 0;
}

int ASocketConnector::reset_list(unsigned Random_seed)
{ int g=0;

	AFunctionLock lock(mutex);

	if(Random_seed)
	random_seed=Random_seed; 
	
	return 0;
}
	
int ASocketConnector::connect(ASocket& z)
{ int g=0;

	AFunctionLock lock(mutex);
	
	if(bound)
	{
		IPSocketAddress bind_socket_address=bind_address;
		bind_socket_address.set_port(bind_port);
		z.bind(bind_socket_address);
	}


	return 0;
}