From owner-freebsd-hackers Fri May 18 3:42:17 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ns.wuppy.net.ru (ns.WUPPY.NET.RU [212.30.189.130]) by hub.freebsd.org (Postfix) with ESMTP id 00D1337B423 for ; Fri, 18 May 2001 03:42:10 -0700 (PDT) (envelope-from romanp@unshadow.net) Received: by ns.wuppy.net.ru (Postfix, from userid 66) id E28341DD0; Fri, 18 May 2001 14:41:56 +0400 (MSD) Received: from localhost (localhost [127.0.0.1]) by abyss.unshadow.net (8.12.0.Beta7/8.12.0.Beta5) with ESMTP id f4IAFDJI007513; Fri, 18 May 2001 14:15:13 +0400 (MSD) Date: Fri, 18 May 2001 14:15:13 +0400 (MSD) From: "Roman V. Palagin" To: Archie Cobbs Cc: Subject: Re: How to transfer data from netgraph node to user program? In-Reply-To: <200105172004.f4HK4Jm76648@arch20m.dellroad.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: X-Loop: FreeBSD.ORG On May 17, at 1:04pm -0700, Archie Cobbs wrote: > > The question is: how I can initiate smth. like asynchronous reply (so I > > can get data via NgRecvMsg later in my prgram)? Or I'm going wrong way and > > should use another scheme for data transfer? Data size ranges from 10Kb to > > 500Kb. > > Whenever you're ready to send the reply, just create one and send it. It doesn't work. This is fragment of my code: user-level program: .... token = NgSendMsg(..., NGM_XXX_SHOW, ...); /* XXX not reached until ng_xxx_msg() returns */ for(;;) { ... error = NgRecvMsg(...) ... } netgraph node: /* * Process control messages */ int ng_xxx_msg() { .... case NGM_XXX_SHOW: error = ng_xxx_show_data() goto out; .... out: .... return (error); } /* * send collected data */ int ng_xxx_show_data() { for(;;) { get_next_data_item(); if (no_more_data) break; NG_MKRESPONSE() error = ng_send_msg() } return (error); } When size of collected data about 10Kb, all works fine. But when I need to send 400Kb in reply - oops, ng_xxx_show_data() returns ENOBUFS (I think because ng_socket receive queue is full, nobody reads from socket). So, I don't understand how I can transfer large amount of data :-\ Any ideas? - Roman --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message