I have created an SNMP Agent using the example-daemon code as a go by and 
making it a master agent implementing the mib2c code I converted into a class 
for a personal mib.    When I initialize the SNMP agent and then deinitialize 
the agent, I can't start up the agent again without shutting down the entire 
program and then restarting it.  I also noticed that if I didn't shutdown 
everything in the order I have in my Stop function that I would get massive 
memory leaks.  The other problem I am having is that when I use the code from 
the mib2c which was created using the MFD option I get a massive increase in 
memory usage over time.  Is this normal or is this indicative of something I am 
doing wrong?
   
  Here's my code for intializing and deinitializing:
   
  Start()
  {
  /*initialize the tcpip, if necessary */
  SOCK_STARTUP;
  int result;
   
  /*initialize the agent library */
  result = init_agent("SNMPAgent");
   
  /* initialize mib code here */
   
  MIBTable.InitMIBTable();
   
  init_snmp("SNMPAgent");
   
  result = init_master_agent();  /* open the port to listen on (dfeaults to 
udp:161) */
   
  // Start the timer for periodically calling agent_check_and_process
  m_iTimerID = SetTimer(1, 5, 0); 
   
  }
   
  Stop()
  {
   
  KillTimer(m_iTimerID);
   
  /* at shutdown time */
  shutdown_master_agent();
  snmp_shutdown("SNMPAgent");
  shutdown_agent();
  SOCK_CLEANUP;
  }


Leif Pitcock
(256) 656-2502
       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to