On Thu, 6 Nov 2008, Ivo Vachkov wrote:

I am using simple write() calls to send packets over BPF file descriptor. The BPF file descriptor is in buffered read mode (I assume this is the default and I do not set it explicitly). From what I see my write() calls are somewhat buffered. Since timing is relatively important for my project I'd like to ask if there is a way "flush" the write buffer. Setting O_DIRECT flag on the file descriptor doesn't seem to have any effect.

The write(2) system call does no buffering in userspace (unlike, say, fwrite(3)), and when you write to a BPF device it essentially goes straight into the network interface output queue, so there should be no need for a flush mechanism. Could you describe the buffering effect you're seeing a bit more?

Robert N M Watson
Computer Laboratory
University of Cambridge
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to