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

write() Function

The write filter method is called when output data is to be sent. Filters that modify or consume outgoing data should implement the write filter method.

Upon receiving control, a write implementation should first process the data as necessary, and then pass it on to the next filter layer, for example, by calling net_write(layer->lower, ...,). If the filter buffers outgoing data, it should implement the flush filter method.

Syntax

int write(FilterLayer *layer, const void *buf, int amount);

Return Values

The number of bytes consumed, which might be less than the requested amount if an error occurred.

Parameters

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

const void *buf is the buffer that contains the outgoing data.

int amount is the number of bytes in the buffer.

Example

int myfilter_write(FilterLayer *layer, const void *buf, int amount)
{
    return net_write(layer->lower, buf, amount);
}

See Also

flush() Function, net_write() Function, writev() Function, filter_create() Function