Sun Java System Web Server 7.0 Update 3 NSAPI Developer's Guide

flush() Function

The flush filter method is called when buffered data should be sent. Filters that buffer outgoing data should implement the flush filter method.

Upon receiving control, a flush implementation must write any buffered data to the filter layer immediately below it. Before returning success, a flush implementation must successfully call the net_flush function:



int flush(FilterLayer *layer);

Return Values

0 on success or -1 if an error occurs.


FilterLayer *layer is the filter layer the filter is installed in.


int myfilter_flush(FilterLayer *layer)
    MyFilterContext context = (MyFilterContext *)layer->context->data;
    if (context->buf.count) {
       int rv;
       rv = net_write(layer->lower, context->, context->buf.count);
       if (rv != context->buf.count)
           return -1; /* failed to flush data */
       context->buf.count = 0;
    return net_flush(layer->lower);

See Also

net_flush() Function, filter_create() Function