[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: Re: Peeking BPF
From: Lev Walkin <vlm () netli ! com>
Date: 2004-06-29 17:08:08
Message-ID: 40E1A1F8.90003 () netli ! com
[Download RAW message or body]
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
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic