[AGENT++]agent++v3.5.19 error wiht the prxoy

益泸 欧 oyljerry at hotmail.com
Mon Jul 26 12:53:34 CEST 2004


hi Jochen
I found the define of the uxsnmp.h is different from the former version and 
in the new version of snmp++ ,it adds the "socket_startup() and 
socket_cleanup()" so maybe it the reason why my code can not put through? 
what the purpose to add these?
althrough ,I have add these ,but ,when i send GET to my proxy ,
it crush,can you give me some help!  the full code as below :
 void main (int argc, char* argv[])
 {
	if (argc>1)
		port = atoi(argv[1]);
	else
		port = 4700;

	if (port==0) 

	source.set_port(161);
	if (argc>2)
		source = argv[2];

	if (argc>3)
		source.set_port(atoi(argv[3]));
	int status;
           Snmp::socket_startup();	
	Snmpx snmp(status, port);
	mib = new Mib();
	requestList = new RequestList();
	// register request list
	mib->set_request_list(requestList);

	if (status == SNMP_CLASS_SUCCESS) {

		LOG_BEGIN(EVENT_LOG | 1);
		LOG("main: SNMP listen port");
		LOG(port);
		LOG_END;
	}
	else {
		LOG_BEGIN(ERROR_LOG | 0);
		LOG("main: SNMP port init failed");
		LOG(status);
		LOG_END;
		exit(1);
	}
	requestList->set_snmp(&snmp);
	Request* req;
	while (run) {	  
		req = requestList->receive(2);
		if (req) {
		    mib->process_request(req);
		}
		else {
		    mib->cleanup();
		}
	}
	delete mib;
	Snmp::socket_cleanup();
}
Thanks 
                                                                Jerry

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  




More information about the AGENTPP mailing list