示例#1
0
void Tracker::hostResolved(HostInfo info) {
	if (info.error()) {
		logError(
			boost::format("[%s] Host lookup failed: %s")
			% info.getName() % info.errorMsg()
		);
		Utils::timedCallback(this, &Tracker::hostLookup, 60000);
	} else {
		m_addrs = info.getAddresses();
		for (uint32_t i = 0; i < m_addrs.size(); ++i) {
			m_addrs[i].setPort(m_port);
		}
		m_curAddr = m_addrs.begin();
		connect(*m_curAddr);
	}
}
示例#2
0
void printHostInfo(HostInfo& h)//string name, queue<string> ipaddr)
{
	#ifdef WIN32
	//cout << "host information mode" << endl;
	if(h.ipaddr.empty())
		return;
	cout << "Official Name: " << h.getName() << endl;
	while (!h.ipaddr.empty())
	{
		cout << "IP Address: " << h.ipaddr.front() << endl;
		h.ipaddr.pop();
	}
	#else
		cout << "Windows only function" << endl;
	#endif
	return;
}