> I use SuSE.7.0 and under Linux select works.
Then use "select()".
Put the file descriptor for the pcap device into non-blocking mode - use
"pcap_fileno()" to get the file descriptor, and use "fcntl()" to set
O_NONBLOCK - and then, in the input loop, use "select()" on both that
file descriptor and whatever file descriptors are used for user input.
(If this is, for example, an X application, the toolkit you're using
probably has its own input loop, so you'd have to use whatever call it
offers to register the libpcap file descriptor as an input source, e.g.
XtAddInput for Xt-based toolkits (Athena widgets, Motif, Xol or
whatever AT&T's Xt-based OPEN LOOK toolkit was called)
gtk_input_add_full for GTK+ 1.2[.x]
etc..)
In order to make the application portable to the BSDs, you should also
arrange that the "select()" have a timeout, and, if the timeout expires,
try reading from the pcap device (on many BSDs, "select()" doesn't work
right on BPF devices, those being what libpcap uses on BSDs). (For X
applications, you'd have to register a timeout with the toolkit.)
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:[EMAIL PROTECTED]?body=unsubscribe