From owner-freebsd-net@FreeBSD.ORG Tue Jan 6 15:30:34 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE27B16A579 for ; Tue, 6 Jan 2004 15:30:34 -0800 (PST) Received: from mailgw.servicefactory.se (mailgw.servicefactory.se [192.71.33.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD69743D64 for ; Tue, 6 Jan 2004 15:30:22 -0800 (PST) (envelope-from xfree@bulow.mine.nu) Received: from ark.servicefactory.se (ark.servicefactory.se [192.71.33.5]) i06NUKw22159 for ; Wed, 7 Jan 2004 00:30:20 +0100 (CET) Received: from bulow.mine.nu (ark.servicefactory.se [192.71.33.5]) by ark.servicefactory.se (8.12.9/8.12.6) with ESMTP id i06NTNmP000243 for ; Wed, 7 Jan 2004 00:29:23 +0100 (CET) (envelope-from xfree@bulow.mine.nu) Message-ID: <3FFB450A.6070403@bulow.mine.nu> Date: Wed, 07 Jan 2004 00:30:18 +0100 From: Jonas Bulow User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6b) Gecko/20031218 X-Accept-Language: en-us, en, sv MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: netgraph and kqueue together - socket problems X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2004 23:30:34 -0000 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