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

sendfile() Function

The sendfile filter method is called when the contents of a file are to be sent. Filters that modify or consume outgoing data can choose to implement the sendfile filter method.

If a filter implements the write filter method but not the sendfile filter method, the server will automatically translate net_sendfile() calls to net_write() calls. As a result, filters interested in the outgoing data stream do not need to implement the sendfile filter method. However, for performance reasons, filters that implement the write filter method should also implement the sendfile filter method.


int sendfile(FilterLayer *layer, const sendfiledata *data);

Return Values

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


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

const sendfiledata *sfd identifies the data to send.


int myfilter_sendfile(FilterLayer *layer, const sendfiledata *sfd)
    return net_sendfile(layer->lower, sfd);

See Also

net_sendfile() Function, filter_create() Function