adding new socket fd to existing read fd list of netsnmp

[email protected]
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello,

I am just concerned about how to add a new socket fd for socket communication with alarm Application to existing fd list netsnmp is listening for.

                                          Manager
                                           ||
                                           ||
    Alarm Application ======Agent

For this i tried :

main()
{
        init_agent("snmpV3Agent");
        init_currentAlarmTable();
        init_snmp("snmpV3Agent");
         ... .
         ........
        //start listning for client
        listener = socket(AF_INET, SOCK_STREAM, 0);
        bind(listener, (struct sockaddr *)&myaddr, sizeof(myaddr));
        listen(listener, 10)

        while()
        {
            snmp_select_info(&numfds, &read_fds, NULL, 0);
            select(numfds,&read_fds,0,0,NULL)
             if (FD_ISSET(listener , &read_fds))
             {
                 //accept when ready to be read
                 newfd = accept(listener, (struct sockaddr *)&remoteaddr,&addrlen)
                
                  //myfunction1 --->reads the data add it to queue and forward to manager as a TRAP
                 register_readfd(&numfds,(*myfunction1),NULL);
             }
         }

}

or it is that i just need to call snmp_select_info() with readfds containing my new socket fd and just call register_readfd() and i not even need to check for FD_ISSET(). This will automatically accept the connection when the fd is ready to be read and in the function pointer(call back method) i can write the code to extract the data.

Is it. Please do reply if i am wrong anywhere.

Thanks

-------------------------------------------------------------------------
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-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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.