On Mon, Jun 09, 2008 at 11:53:23AM +0530, [EMAIL PROTECTED] wrote:
> I am thinking of doing it in following manner.
> Please comment on the following if it is wrong

It's been a while since I have done this, but I think that the count of FDs
is not being set properly. ** NOTE INLINE

> main()
> {
>         fd_set master;
>         fd_set read_fds;
>         int listener;
>         int fdmax;                    ** UNUSED
>         int newfd;
> 
>       FD_ZERO(&master); 
>       FD_ZERO(&read_fds);
> 
>         listener = socket(AF_INET, SOCK_STREAM, 0);
>         bind(listener, (struct sockaddr *)&myaddr, sizeof(myaddr));
>         listen(listener, 10)
> 
>       // add the listener to the master set
>       FD_SET(listener, &master);
>         fdmax = listener;             ** UNUSED
> 
>          while()
>          {

                int numfds = listener+1;        ** ADD THIS

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

-- 
Stephen J Friedl | Security Consultant |  UNIX Wizard  |   +1 714 544-6561
www.unixwiz.net  | Tustin, Calif. USA  | Microsoft MVP | [EMAIL PROTECTED]

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