Date: Tue, 29 Jun 2004 10:08:08 -0700 From: Lev Walkin <vlm@netli.com> To: Ivan Voras <ivoras@fer.hr> Cc: hackers@freebsd.org Subject: Re: Peeking BPF Message-ID: <40E1A1F8.90003@netli.com> In-Reply-To: <40E177DB.6070506@fer.hr> References: <40E177DB.6070506@fer.hr>
next in thread | previous in thread | raw e-mail | index | archive | help
Ivan Voras wrote: > > I need to convert this code: > > ret = recvfrom(thisint->sockInt, &resultframe, 1520, MSG_PEEK, 0, 0); > if (ret > 0) return TRUE; > > to use BPF. Essentialy, how to find out if a packet is available over > the BPF interface? try to read() it and read() will hang there until there is data in it. alternatively, use poll() or select() to check for readability event. char resultBuffer[65536]; ret = read(thisint->bpfInt, resultBuffer, sizeof(resultBuffer)); if(ret > 0) return TRUE; -- Lev Walkin vlm@netli.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40E1A1F8.90003>