In my application I open a session (in wich I want to listen for traps on port 
162) like this:

    SOCK_STARTUP;
    init_snmp("snmpapp");
    netsnmp_session session, *ss;
    netsnmp_transport *transport = NULL;
    transport = netsnmp_tdomain_transport("udp:162",1,"udp");
    if (transport == NULL) {
        wxLogError("couldn't open udp:162 -- errno %d %s",errno, 
strerror(errno));
        wxLogError("SNMP failure: %s",snmp_errstring(session.s_snmp_errno));
        }
    snmp_sess_init( &session );
    session.peername = strdup((AgentIP->GetValue()).c_str());
    session.version = SNMP_VERSION_1;
    session.community = "public";
    session.community_len = strlen(session.community);
    session.local_port = 162;
    session.callback = &TrapListener;
    session.callback_magic = (void*) Risposta;
    ss = snmp_add(&session, transport, NULL, NULL);

and When I close ss the return value is 0 so an error should have occured, 
right?
I tried every closing method I could think of (except snmp_close_sessions() 
becasue  trying that I get a linker error so I couldn't use it) and:

    snmp_close(&session) returns 0,
    snmp_sess_close(&session) returns 1,
    snmp_close(ss) returns 0,
    snmp_sess_close(ss) returns 0

this regardless of the order in wich i put them and regardelss of where i put 
SOCK_CLEANUP.

Could please anyone tell me what I'm doing wrong?


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-modeĀ™ di Wind
http://i-mode.wind.it/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to