tcpdump mailing list archives

Re: Problems with select (the other way around...)


From: Michael Richardson <mcr () sandelman ottawa on ca>
Date: Fri, 15 May 2009 21:05:33 -0400


"Ricardo" == Ricardo Balbinot <rbalbinot () gmail com> writes:
    Ricardo> tv.tv_sec = 1;
    Ricardo> tv.tv_usec = 0;
    Ricardo> FD_ZERO(&rfds);
    Ricardo> FD_SET(handle_fd,&rfds);
    Ricardo> retval = select(1, &rfds, NULL, NULL, &tv);

The first argument to select is the highest FD that you want to look at.
Essentially, this sizes the bitfields ("fdsets").

"
       nfds  is the highest-numbered file descriptor in any of the three sets,
       plus 1.
"

so, you need to set it to "handle_fd + 1"

-- 
]     Y'avait une poule de jammé dans l'muffler!!!!!!!!!        |  firewalls  [
]   Michael Richardson, Sandelman Software Works, Ottawa, ON    |net architect[
] mcr () sandelman ottawa on ca http://www.sandelman.ottawa.on.ca/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: