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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to