starting and closing Net-SNMP
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I started to make my own snmptrapd.exe tool (used snmptrapd as an
example). So far im already receiving traps and displaying received
variables with OIDs on screen.
But i got some errors when closing the trap receiver. I'll try to
describe what i got:
I have one function that initializes snmp, goes into loop waiting for
traps and when i want, goes out of the loop and shuts down snmp.
Application doesn't terminate, i can start the receiver again,
without restarting (or should i say, i want to be able to do
that...).
So when the function is called i have something like this:
init_snmp("snmptrapd");
SOCK_STARTUP;
netsnmp_session *ss = NULL,*sess_list = NULL;
netsnmp_transport *transport = NULL;
transport = netsnmp_transport_open_server("snmptrapd", "udp:162");
if(!transport)
{
// Printing some error messages
SOCK_CLEANUP;
return 0;
}
ss = snmptrapd_add_session(transport);
if(!ss)
{
// Printing some error messages
netsnmp_transport_free(transport);
SOCK_CLEANUP;
return 0;
}
else
{
ss->next=sess_list;
sess_list=ss;
}
// ......
And then, at the end, i have these lines:
SOCK_CLEANUP;
netsnmp_transport_free(transport);
snmptrapd_close_sessions(sess_list); // next;
snmp_close(s); //
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users