Hi,

I'm writing a program using libpcap.

the code is written like:

    static pcap_t *pd;
    static int do_loop = 1;

    int main (void)
    {
        /* signal handler set */
        ...

        while (do_loop) {
            pcap_dispatch(pd, -1, callback, NULL);
        }

        close(pd);
    }

    static void sig_term(void)
    {
        do_loop = 0;
    }

I have a question.

The question is this sample is programed to exit from loop
when the program received TERM signal.  Could you please
teach me the way to program to exit right after line 16.
The problem of this sample is even if program received
TERM signal, pcap_dispatch() blockes until libpcap
recognize the next packet.  I would like to make a program
unblock pcap_dispatch() when the program received TERM
signal.  If you know the better way to exit the program
right after receiving TERM signal without receiving next
packet.

Thanks in advance.

-- 
Takuhiro Nishioka [EMAIL PROTECTED]
-
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

Reply via email to