I'm triying to write an application that start a session and listen for traps 
on port 162. I'd like the application to be able to create several successive 
sessions.
Having some problem with closing the previous session I'd like to set myself 
(without using snmp_select_info) the fdset and fds parameters for select.
I read the code of snmp_select_info and it seems to me that the core is these 
two lines:

    *numfds = (slp->transport->sock + 1);
    FD_SET(slp->transport->sock, fdset);

So I thoght that if I could set fdset only with the currently active socket 
then select should work fine and here is what I tried to do:

    int fds = 0, block = 0, nopsess = 0;
    fd_set fdset;
    struct timeval timeout;
    timeout.tv_sec = 0;
    timeout.tv_usec = 100000;//100 ms
    FD_ZERO(&fdset);
    unsigned int prova;
    //transport is a pointer to the netsnmp_transport I created for the session
    prova = (unsigned int) &transport->sock;
    fds = prova +1;
    FD_SET(prova, &fdset);
    fds = select(fds, &fdset, 0, 0, &timeout);

But from select i get a "No such file or directory" error. 
Could please anyone tell me what's wrong in my code?


------------------------------------------------------
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