Example #1
0
void		BBWinAgentManager::Query(LPCTSTR testName, LPTSTR dest, DWORD size) {
	bbdisplay_t::iterator			itr;
	BBWinNet	hobNet;
	string		result;

	assert(testName != NULL);
	assert(dest != NULL);
	itr = m_bbdisplay.begin();
	hobNet.SetBBDisplay((*itr));
	PrepareBBWinNetObj(hobNet);
	try {
		hobNet.Query(testName, result);
	} catch (BBWinNetException ex) {
		if (m_logReportFailure) {
			string mes;

			mes = "Sending config message to " + (*itr) + " failed.";
			LPCTSTR		arg[] = {m_agentName.c_str(), mes.c_str(), NULL};
			m_log->reportWarnEvent(BBWIN_AGENT, EVENT_MESSAGE_AGENT, 2, arg);
		}
	}
	try
	{
		if (dest != NULL && size != 0)
			strncpy(dest, result.c_str(), size);
	}
	catch (...)
	{
		// Failed to write
	}
}
Example #2
0
void 	Query(int argc, char *argv[], BBWinNet & bbobj)
{
	cout << "Sending query ...\n";
	bbobj.SetHostName(argv[3]);
	cout << "hostname defined to: " << argv[3] << "\n";
	try {
		string res;
		
		bbobj.Query(argv[4], res);
		cout << "\n" << res << "\n\n";
	} catch (BBWinNetException ex) {
		cout << "Error : " << ex.getMessage() << "\n";
	}
}