netgraph and kqueue together - socket problems
Jonas Bulow
xfree at bulow.mine.nu
Tue Jan 6 15:30:34 PST 2004
Hi,
I'm trying to use netgraph and kqueue together and ran into some
problems. I hope someone can enligthen me what I'm missing.
I register EVFILT_READ and EVFILT_WRITE on a netgraph-socket connected
to a netgraph echo-node. The EVFILT_WRITE-filter returns immediately
from the kevent call saying there is 20480 bytes remaining in the write
buffer (in the event data field). Then I write 20480 using NgSendData.
NgSendData encounters an error: "No buffer space available".
When I write fewer but smaller chunks of data, say ~3000 bytes, the next
call to kevent returns the same amount of remaining space in the write
buffer. The kqueue event data field never change from 20480 for the
EVFILT_WRITE-filter.
Now I understand that there are some overhead in the NgSendData. It's
not just my data that are written through the socket. The addressing
data adds some data when NgSendData calls sendto. Right?
But, how do I calculate the true amount of remaining buffer space
available for me when I call NgSendData?
And, why does kevent EVFILT_WRITE always say 20480 on repeated calls to
kevent on a netgraph-socket, even if I have successfully written some
data between the calls to kevent?
The netgraph-node the programming is talking to is a echo-node set up with:
#ngctl mkpeer echo dummy foo
Regards,
Jonas
More information about the freebsd-net
mailing list