Date: Fri, 18 May 2001 14:15:13 +0400 (MSD) From: "Roman V. Palagin" <romanp@unshadow.net> To: Archie Cobbs <archie@dellroad.org> Cc: <freebsd-hackers@freebsd.org> Subject: Re: How to transfer data from netgraph node to user program? Message-ID: <Pine.SOL.4.33.0105181351210.6629-100000@abyss.unshadow.net> In-Reply-To: <200105172004.f4HK4Jm76648@arch20m.dellroad.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.33.0105181351210.6629-100000>